main #31

Merged
juan merged 154 commits from main into lab 2024-10-16 15:22:43 +00:00
19 changed files with 58 additions and 38 deletions
Showing only changes of commit 77616531ab - Show all commits

View File

@ -16,7 +16,7 @@ locally to ensure they work properly.
Launch playbook on the fly on a host not declared in the inventory. Launch playbook on the fly on a host not declared in the inventory.
``` ```
ansible-playbook playbooks/test.yml -u root -i <ip_or_hostname>, ansible-playbook -u root -i <ip_or_hostname>, playbooks/test.yml
``` ```
*Note the comma at the end of the hostname or IP.* *Note the comma at the end of the hostname or IP.*

View File

@ -1,6 +1,7 @@
- hosts: all - name: Configure AWX user
hosts: all
gather_facts: no gather_facts: no
become: no
tasks: tasks:
- name: Configure AWX user - import_role:
import_role:
name: awx name: awx

13
playbooks/clean.yml Normal file
View File

@ -0,0 +1,13 @@
- name: Clean deprecated configuration
hosts: all
gather_facts: no
tasks:
- name: Delete awx-user
ansible.builtin.user:
name: awx-user
state: absent
remove: yes
- name: Delete awx-user sudoers file
file:
path: /etc/sudoers.d/awx-user
state: absent

View File

@ -1,5 +1,5 @@
- hosts: all - name: Upgrade Debian host
hosts: all
tasks: tasks:
- name: Upgrade system - import_role:
import_role:
name: debian-upgrade name: debian-upgrade

View File

@ -1,4 +1,5 @@
- hosts: all - name: Configure base Debian host
hosts: all
tasks: tasks:
- name: Configure base system - name: Configure base system
import_role: import_role:

View File

@ -1,4 +1,5 @@
- hosts: all - name: Gather facts from host
hosts: all
gather_facts: yes gather_facts: yes
tasks: tasks:
- name: Print all available facts - name: Print all available facts

View File

@ -1,5 +1,5 @@
- hosts: all - name: Install and configure Freeradius with TOTP
hosts: all
tasks: tasks:
- name: Install and configure Freeradius with TOTP - import_role:
import_role:
name: freeradius name: freeradius

View File

@ -1,5 +1,5 @@
- hosts: ns1 - name: Configure zone with nsupdate
hosts: ns1
tasks: tasks:
- name: Configure zone with nsupdate - import_role:
import_role: name: nsupdate
name: nsupdate

View File

@ -1,3 +1,4 @@
- hosts: all - name: Check that a host is alive and reachable
hosts: all
tasks: tasks:
- ping: - ping:

View File

@ -1,6 +1,6 @@
- hosts: localhost - name: Send mail
hosts: localhost
become: no become: no
tasks: tasks:
- name: Send mail - import_role:
import_role:
name: send-mail name: send-mail

View File

@ -1,5 +1,5 @@
- hosts: all - name: Test role
hosts: all
tasks: tasks:
- name: Test role - import_role:
import_role:
name: debian-base name: debian-base

View File

@ -1,5 +1,4 @@
- name: Ping Windows hosts - name: Ping Windows host
hosts: all hosts: all
tasks: tasks:
- name: Ping Windows hosts - ansible.windows.win_ping:
ansible.windows.win_ping:

View File

@ -1,4 +1,5 @@
- hosts: all - name: Update windows host
hosts: all
serial: 1 serial: 1
tasks: tasks:
- block: - block:

View File

@ -1,4 +1,4 @@
- name: Create AWX user - name: Create awx user
user: user:
name: awx name: awx
password: '*' password: '*'
@ -6,7 +6,7 @@
groups: sudo groups: sudo
state: present state: present
comment: ssh user comment: ssh user
- name: Adding SSH public key - name: Add awx SSH public key
authorized_key: authorized_key:
user: awx user: awx
key: "{{ awx_pub_key }}" key: "{{ awx_pub_key }}"
@ -14,7 +14,7 @@
apt: apt:
name: sudo name: sudo
state: present state: present
- name: Add user to sudoers - name: Add awx user to sudoers
copy: copy:
src: sudoers src: sudoers
dest: /etc/sudoers.d/awx dest: /etc/sudoers.d/awx

View File

@ -1,9 +1,12 @@
- import_tasks: install.yml - import_tasks: install.yml
- import_tasks: locale.yml - import_tasks: locale.yml
- import_tasks: tzdata.yml - import_tasks: tzdata.yml
- import_tasks: motd.yml
- import_tasks: profile.yml
- import_tasks: vim.yml
- import_tasks: sudoers.yml
- import_tasks: nrpe.yml
- import_tasks: relayhost.yml - import_tasks: relayhost.yml
- import_tasks: motd.yml
tags: [motd]
- import_tasks: profile.yml
tags: [profile]
- import_tasks: vim.yml
tags: [vim]
- import_tasks: nrpe.yml
tags: [nrpe]

View File

@ -1,4 +1,3 @@
- name: Install packages - name: Install packages
apt: apt:
name: nslcd name: nslcd
@ -36,4 +35,4 @@
- name: Restart NSLCD service - name: Restart NSLCD service
service: service:
name: nslcd name: nslcd
state: restarted state: restarted

View File

@ -1,2 +1,3 @@
- include_tasks: auth.yml - include_tasks: auth.yml
when: false when: false
- import_tasks: sudoers.yml

View File

@ -2,7 +2,7 @@
apt: apt:
name: sudo name: sudo
state: present state: present
- name: Copy sudoers configuration file - name: Add sysadmin to sudoers
copy: copy:
src: sudoers src: sudoers
dest: /etc/sudoers.d/vn dest: /etc/sudoers.d/vn