User Tools

Site Tools


сервис_ansible

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
сервис_ansible [2025/02/11 14:00]
val [Роль OpenVPN сервера]
сервис_ansible [2025/06/02 13:30] (current)
val [Провижининг IP телефонов]
Line 108: Line 108:
 node1# ansible all -m ping node1# ansible all -m ping
 node1# ansible all -m ping -i inv_file.ini node1# ansible all -m ping -i inv_file.ini
-node1# ansible all -m ping -i node2:​2222, ​-e "​ansible_python_interpreter=/​usr/​bin/​python3"​+node1# ansible all -m ping -i node2:2222,
  
 node1# ansible corpX -m command -a 'uname -a' node1# ansible corpX -m command -a 'uname -a'
  
-kube1# ansible kubes -a 'sed -i""​ -e "/​swap/​s/​^/#/"​ /​etc/​fstab'​ 
-kube1# ansible kubes -a '​swapoff -a' 
-  ИЛИ 
 (venv1) server# ansible all -a 'sed -i""​ -e "/​swap/​s/​^/#/"​ /​etc/​fstab'​ -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml #​--limit=kube4,​kube5 (venv1) server# ansible all -a 'sed -i""​ -e "/​swap/​s/​^/#/"​ /​etc/​fstab'​ -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml #​--limit=kube4,​kube5
 (venv1) server# ansible all -a '​swapoff -a' -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml #​--limit=kube4 (venv1) server# ansible all -a '​swapoff -a' -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml #​--limit=kube4
Line 347: Line 344:
  
 server# ansible-playbook inst_http.yml -i gate, server# ansible-playbook inst_http.yml -i gate,
-</​code><​code>​+</​code>​ 
 + 
 +==== Asterisk IAX конфигурация ==== 
 + 
 +<​code>​
 # cat iax.conf.j2 # cat iax.conf.j2
 </​code><​code>​ </​code><​code>​
Line 385: Line 386:
 </​code><​code>​ </​code><​code>​
 # ansible-playbook ast_iax_corps.yml --extra-vars '​{"​X":"​{{ ansible_eth0.ipv4.address.split(\"​.\"​)[3] }}","​YS":​[1,​2,​3,​4,​5,​6,​7,​8,​9,​10,​11,​12,​13]}'​ # ansible-playbook ast_iax_corps.yml --extra-vars '​{"​X":"​{{ ansible_eth0.ipv4.address.split(\"​.\"​)[3] }}","​YS":​[1,​2,​3,​4,​5,​6,​7,​8,​9,​10,​11,​12,​13]}'​
 +</​code>​
 +
 +==== Провижининг IP телефонов ====
 +<​code>​
 +~/​phone-prov#​ cat inventory.yml
 +</​code><​code>​
 +all:
 +  vars:
 +    phones:
 +      - [ '​403',​ '​tpassword403',​ '​server.corp13.un',​ '​000E08C190C2',​ '​spa'​ ]
 +      - [ '​404',​ '​tpassword404',​ '​server.corp13.un',​ '​BCC34221709A',​ '​kx-hdv'​ ]
 +</​code><​code>​
 +~/​phone-prov#​ cat kx-hdv.j2
 +</​code><​code>​
 +# Panasonic SIP Phone Standard Format File #
 +
 +## SIP Settings
 +PHONE_NUMBER_1="​{{ pn }}"
 +SIP_AUTHID_1="​{{ pn }}"
 +SIP_PASS_1="​{{ secret }}"
 +SIP_PRXY_ADDR_1="​{{ sipproxy }}"
 +SIP_RGSTR_ADDR_1="​{{ sipproxy }}"
 +DIAL_PLAN_1="​*xx|[1-4]xx|0xxxxx|8xxxxxxxxxx"​
 +</​code><​code>​
 +~/​phone-prov#​ cat spa.j2
 +</​code><​code>​
 +<​flat-profile>​
 +  <​Proxy_1_>​{{ sipproxy }}</​Proxy_1_>​
 +  <​User_ID_1_>​{{ pn }}</​User_ID_1_>​
 +  <​Password_1_>​{{ secret }}</​Password_1_>​
 +  <​Dial_Plan_1_>​( xxx | 8xxxxxxxxxx | 0xxxxx | *xx )</​Dial_Plan_1_>​
 +</​flat-profile>​
 +</​code><​code>​
 +~/​phone-prov#​ cat phone-prov.yml
 +</​code><​code>​
 +- hosts: localhost
 +  tasks:
 +    - name: debug
 +      debug:
 +        msg: "{{ item.0 }} ... {{ item.4 }}"
 +      loop: "{{ phones }}"
 +    - name: Create phone conf
 +      template:
 +        src: "{{ model }}.j2"
 +        dest: "/​var/​www/​html/​{{ model }}-{{ mac }}.cfg"​
 +      vars:
 +        pn: "{{ item.0 }}"
 +        secret: "{{ item.1 }}"
 +        sipproxy: "{{ item.2 }}"
 +        mac: "{{ item.3 }}"
 +        model: "{{ item.4 }}"
 +      loop: "{{ phones }}"
 +</​code><​code>​
 +~/​phone-prov#​ ansible-playbook phone-prov.yml -i inventory.yml
 </​code>​ </​code>​
 ===== Использование handlers ===== ===== Использование handlers =====
  
-==== Пример ​====+==== Пример ​====
  
   * [[Сервис HTTP#​Использование домашних каталогов]]   * [[Сервис HTTP#​Использование домашних каталогов]]
Line 412: Line 467:
 </​code>​ </​code>​
  
-==== Пример ​====+==== Пример ​==== 
 + 
 +  * [[Управление ПО в Linux#​Список desktop приложений]]
  
 <​code>​ <​code>​
Line 422: Line 479:
 UserParameter=listinstalledsoft,​ls /​usr/​share/​applications | awk -F '​.desktop'​ ' { print $1}' - UserParameter=listinstalledsoft,​ls /​usr/​share/​applications | awk -F '​.desktop'​ ' { print $1}' -
 </​code><​code>​ </​code><​code>​
-node1# cat za.yml+server# cat za.yml
 </​code><​code>​ </​code><​code>​
 - hosts: lin_ws - hosts: lin_ws
сервис_ansible.1739271606.txt.gz · Last modified: 2025/02/11 14:00 by val