deployAnsible.yml 709 Bytes
---
- hosts: new-host
  become: true
  tasks:
    - name: New Ansbile Group
      group:
          name: ansbile
          state: present
          
    - name: New Ansible User
      user: useradd -m -c "ansible user" -s /bin/bash -U ansible --uid 1111
          uid: 1111
          home: /home/ansible
          name: ansible
          group: ansible
          shell: /bin/bash
          system: no
          createhome: yes
      
    - name: Grant Permission
      command: usermod -aG sudo ansible
  
    - copy:
            src: /tmp/configuration/authorized_keys
            dest: /home/ansible/.ssh/authorized_keys
            owner: ansible
            group: ansible
            mode: 0600
# Update