Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ansible-playbook main.yaml -i hosts.ini -k -b -v
- ---
- - hosts: all
- tasks:
- - name: Убеждаемся, что есть группа 'wheel'
- group:
- name: wheel
- state: present
- - name: Добавляем пользователя ansible в группу wheel
- user:
- name: ansible
- comment: Ansible Management User
- shell: /bin/bash
- group: wheel
- append: yes
- - name: Отключаем запрос sudo пароля у группы wheel
- lineinfile:
- path: /etc/sudoers.d/ansible
- line: 'ansible ALL=(ALL) NOPASSWD: ALL'
- state: present
- mode: 0440
- create: yes
- validate: 'visudo -cf %s'
- - name: Создаем SSH папку и назначаем права доступа
- file: path=/home/ansible/.ssh state=directory owner=ansible group=ansible mode=700
- - name: Копируем SSH ключ
- authorized_key: user=ansible key={{ lookup('file', 'ansible.pub') }} state=present
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement