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 [2026/03/02 09:20]
val [ansible-vault]
сервис_ansible [2026/10/15 12:06] (current)
val [Роль настроенного через ifupdown узла сети]
Line 35: Line 35:
 debian11/​ubuntu20#​ apt install python python3-apt debian11/​ubuntu20#​ apt install python python3-apt
  
-debian12# apt install python3 python3-apt+debian12/13# apt install python3 python3-apt
 </​code>​ </​code>​
  
Line 44: Line 44:
  
 <​code>​ <​code>​
-deb11_12_ub24# mkdir /​etc/​ansible/​+node1# mkdir /​etc/​ansible/​
  
 node1# cat /​etc/​ansible/​hosts node1# cat /​etc/​ansible/​hosts
Line 461: Line 461:
       notify:       notify:
         - restart apache         - restart apache
 +
 +#    - name: Find all user directories in /home
 +#      ansible.builtin.find:​
 +#        paths: /home
 +#        file_type: directory
 +#        recurse: false
 +#      register: found_directories
 +
 +#    - name: Set 0755 permissions for all user home directories
 +#      ansible.builtin.file:​
 +#        path: "{{ item.path }}"
 +#        mode: '​0755'​
 +#        state: directory
 +#      loop: "{{ found_directories.files }}"
 +#      loop_control:​
 +#        label: "{{ item.path }}"
  
   handlers:   handlers:
Line 593: Line 609:
         gateway 192.168.{{ X }}.254         gateway 192.168.{{ X }}.254
 {% endif %} {% endif %}
-</​code><​code>​+</​code>​ 
 + 
 +  * !!! Может понадобиться выполнить **ДВА раза** (при рестарте dhcpcd затирает resolv.conf) !!! 
 + 
 +<​code>​
 # ansible-playbook -f 5 nodes.yml # ansible-playbook -f 5 nodes.yml
  
Line 603: Line 623:
  
 (venv1) server# ansible-playbook -f 5 /​root/​conf/​ansible/​roles/​nodes.yml -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml -e "​variable_host=all name_prefix=kube"​ #​--limit=kube4 (venv1) server# ansible-playbook -f 5 /​root/​conf/​ansible/​roles/​nodes.yml -i /​root/​kubespray/​inventory/​mycluster/​hosts.yaml -e "​variable_host=all name_prefix=kube"​ #​--limit=kube4
 +
 +c8914ba57f1c:/​kubespray#​ ansible-playbook -f 5 /​root/​conf/​ansible/​roles/​nodes.yml -i /​inventory/​inventory.ini -e "​variable_host=all name_prefix=kube"​ #​--limit=kube4
 </​code>​ </​code>​
  
Line 739: Line 761:
   * [[Сервисы Gateway и routing#​Управление таблицей маршрутизации]]   * [[Сервисы Gateway и routing#​Управление таблицей маршрутизации]]
  
 +==== Использование docker образов для управления версиями ansible ====
 +<​code>​
 +docker run --rm -it -v /​etc/​ansible/:/​etc/​ansible/​ -v /​etc/​resolv.conf:/​etc/​resolv.conf willhallonline/​ansible:​2.21-ubuntu-24.04 ansible -m ping corp
 +
 +docker run --rm -it -v /​etc/​ansible/:/​etc/​ansible/​ -v /​etc/​resolv.conf:/​etc/​resolv.conf -v /​root/​conf/​ansible:/​ansible willhallonline/​ansible:​2.21-ubuntu-24.04 ansible-playbook /​ansible/​roles/​hosts.yml
 +
 +docker run --rm -it -v /​etc/​ansible/:/​etc/​ansible/​ -v /​etc/​resolv.conf:/​etc/​resolv.conf -v /​root/​conf/​ansible:/​ansible willhallonline/​ansible:​2.21-ubuntu-24.04 ansible-playbook /​ansible/​roles/​asterisk.yml
 +
 +docker run --rm -it -v /​etc/​ansible/:/​etc/​ansible/​ -v /​etc/​resolv.conf:/​etc/​resolv.conf -v /​root/​conf/​ansible:/​ansible willhallonline/​ansible:​2.21-ubuntu-24.04 ansible-playbook /​ansible/​roles/​mail.yml --extra-vars "​variable_host=corp"​
 +</​code>​
 ==== ansible-vault ==== ==== ansible-vault ====
  
Line 809: Line 841:
     ansible_ssh_user:​ "{{ openvpn1_arr.username }}"     ansible_ssh_user:​ "{{ openvpn1_arr.username }}"
     ansible_ssh_pass:​ "{{ openvpn1_arr.password }}"     ansible_ssh_pass:​ "{{ openvpn1_arr.password }}"
-    ansible_sudo_pass:​ "{{ openvpn1_arr.password }}"+    ​#ansible_sudo_pass:​ "{{ openvpn1_arr.password }}"
 ... ...
 </​code><​code>​ </​code><​code>​
сервис_ansible.1772432430.txt.gz · Last modified: 2026/03/02 09:20 by val