vms_config
Differences
This shows you the differences between two versions of the page.
| vms_config [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadm | vms_config [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Configuração das VMs ====== | ||
| - | <file yaml vms-config.yaml> | ||
| - | - name: MVs config base | ||
| - | hosts: all | ||
| - | tasks: | ||
| - | - name: Testing entries in the /etc/hosts file | ||
| - | lineinfile: | ||
| - | path: /etc/hosts | ||
| - | line: " | ||
| - | register: etc_hosts_result | ||
| - | |||
| - | - name: Clear file /etc/hosts | ||
| - | when: etc_hosts_result is changed | ||
| - | shell: echo '' | ||
| - | register: etc_hosts_clear | ||
| - | tags: hosts | ||
| - | |||
| - | - name: Config file /etc/hosts | ||
| - | when: etc_hosts_clear is succeeded | ||
| - | lineinfile: | ||
| - | path: /etc/hosts | ||
| - | line: "{{ item.ip }} {{ item.fqdn }} {{ item.alias }}" | ||
| - | with_items: | ||
| - | - { ip: ' | ||
| - | - { ip: ' | ||
| - | - { ip: ' | ||
| - | - { ip: ' | ||
| - | - { ip: ' | ||
| - | |||
| - | - name: Add User | ||
| - | user: | ||
| - | name: suporte | ||
| - | comment: " | ||
| - | shell: /bin/bash | ||
| - | password: $1$Jd0cyBxz$NMyEIiuVgXCsO2WFCcRvU0 | ||
| - | |||
| - | - name: Create .ssh for the new user | ||
| - | file: | ||
| - | mode: 0700 | ||
| - | owner: suporte | ||
| - | group: suporte | ||
| - | path: / | ||
| - | state: directory | ||
| - | |||
| - | - name: Copy authorized_keys to new user's .ssh folder | ||
| - | ansible.builtin.copy: | ||
| - | src: / | ||
| - | dest: / | ||
| - | owner: suporte | ||
| - | group: suporte | ||
| - | mode: 0644 | ||
| - | |||
| - | - name: Add user to sudo | ||
| - | ansible.builtin.lineinfile: | ||
| - | path: / | ||
| - | line: ' | ||
| - | mode: 0440 | ||
| - | create: yes | ||
| - | validate: / | ||
| - | |||
| - | - name: Disable password login | ||
| - | ansible.builtin.lineinfile: | ||
| - | path: / | ||
| - | regexp: " | ||
| - | line: " | ||
| - | |||
| - | - name: SSH restart | ||
| - | ansible.builtin.service: | ||
| - | name: sshd | ||
| - | state: restarted | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible-playbook --syntax-check vms-config.yaml | ||
| - | |||
| - | playbook: vms-config.yaml | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible debian -m shell -a " | ||
| - | de-vm-03 | CHANGED | rc=0 >> | ||
| - | suporte: | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible oracle -m shell -e ' | ||
| - | ol-vm-02 | CHANGED | rc=0 >> | ||
| - | suporte: | ||
| - | </ | ||
| - | |||
| - | ===== Referências ===== | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
| - | - [[https:// | ||
vms_config.1753560545.txt.gz · Last modified: by wikiadm
