mirror of
https://github.com/rocky-linux/infrastructure
synced 2024-11-25 06:31:27 +00:00
yaml and ansible linting
This commit is contained in:
parent
ee72d1960f
commit
eeed6dbcb2
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
become: True
|
become: true
|
||||||
tasks:
|
tasks:
|
||||||
- name: Force a fact refresh to have those available in local cache
|
- name: Force a fact refresh to have those available in local cache
|
||||||
setup:
|
setup:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||||||
# What: Creates groups in the idm infrastructure based on the variables provided.
|
# What: Creates groups in the idm infrastructure based on the variables provided
|
||||||
|
|
||||||
- name: Create our initial users
|
- name: Create our initial users
|
||||||
hosts: ipaserver
|
hosts: ipaserver
|
||||||
@ -27,4 +27,3 @@
|
|||||||
nonposix: "{{ ipaPosix }}"
|
nonposix: "{{ ipaPosix }}"
|
||||||
tags:
|
tags:
|
||||||
- groups
|
- groups
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
---
|
---
|
||||||
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
# This playbook is meant to be used with callable variables, like adhoc or AWX.
|
||||||
#
|
|
||||||
# What: Creates users in the idm infrastructure based on the variables provided.
|
# What: Creates users in the idm infrastructure based on the variables provided.
|
||||||
|
|
||||||
- name: Create a User
|
- name: Create a User
|
||||||
@ -36,4 +35,3 @@
|
|||||||
update_password: on_create
|
update_password: on_create
|
||||||
tags:
|
tags:
|
||||||
- users
|
- users
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
playbooks/handlers
|
|
@ -21,4 +21,3 @@
|
|||||||
service:
|
service:
|
||||||
name: auditd
|
name: auditd
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
ipaadmin_password: "{{ ipaadmin_password }}"
|
ipaadmin_password: "{{ ipaadmin_password }}"
|
||||||
name: "{{ item.group }}"
|
name: "{{ item.group }}"
|
||||||
description: "{{ item.description }}"
|
description: "{{ item.description }}"
|
||||||
nonposix: no
|
nonposix: false
|
||||||
loop: "{{ ipagroups }}"
|
loop: "{{ ipagroups }}"
|
||||||
tags:
|
tags:
|
||||||
- groups
|
- groups
|
||||||
|
|
||||||
|
@ -10,4 +10,3 @@
|
|||||||
- rockyadm
|
- rockyadm
|
||||||
hostcat: all
|
hostcat: all
|
||||||
cmdcat: all
|
cmdcat: all
|
||||||
|
|
||||||
|
@ -16,4 +16,3 @@
|
|||||||
loop: "{{ users }}"
|
loop: "{{ users }}"
|
||||||
tags:
|
tags:
|
||||||
- users
|
- users
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
systemd:
|
systemd:
|
||||||
name: libvirtd
|
name: libvirtd
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: true
|
||||||
|
|
||||||
- name: Verify KVM module is loaded
|
- name: Verify KVM module is loaded
|
||||||
shell: "lsmod | grep -i kvm"
|
shell: "lsmod | grep -i kvm"
|
||||||
@ -52,4 +52,6 @@
|
|||||||
file:
|
file:
|
||||||
path: /var/log/ansible.run
|
path: /var/log/ansible.run
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: '0644'
|
||||||
|
user: root
|
||||||
|
group: root
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
become: false
|
become: false
|
||||||
vars_files:
|
vars_files:
|
||||||
- vars/encpass.yml
|
- vars/encpass.yml
|
||||||
|
- vars/rdns.yml
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Checking for user variables"
|
- name: "Checking for user variables"
|
||||||
@ -14,9 +15,8 @@
|
|||||||
success_msg: "Required variables provided"
|
success_msg: "Required variables provided"
|
||||||
fail_msg: "We are missing ipa admin password"
|
fail_msg: "We are missing ipa admin password"
|
||||||
|
|
||||||
- name: "Start users"
|
- name: "Create Reverse Domains"
|
||||||
ipadnszone:
|
ipadnszone:
|
||||||
ipaadmin_password: '{{ ipaadmin_password }}'
|
ipaadmin_password: '{{ ipaadmin_password }}'
|
||||||
name: '{{ internal_domain }}'
|
name: '{{ internal_domain }}'
|
||||||
with_items:
|
with_items: '{{ rdns }}'
|
||||||
- dev.rockylinux.org
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
include: tasks/variable_loader_common.yml
|
include: tasks/variable_loader_common.yml
|
||||||
|
|
||||||
- name: Configure SSH
|
- name: Configure SSH
|
||||||
include: tasks/ssh-config.yml
|
include: tasks/ssh_config.yml
|
||||||
|
|
||||||
- name: Configure harden settings
|
- name: Configure harden settings
|
||||||
include: tasks/harden.yml
|
include: tasks/harden.yml
|
||||||
@ -38,4 +38,3 @@
|
|||||||
mode: '0644'
|
mode: '0644'
|
||||||
user: root
|
user: root
|
||||||
group: root
|
group: root
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@
|
|||||||
- role: ipaclient
|
- role: ipaclient
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: Touching run file that ansible has ran here
|
- name: Touching run file that ansible has ran here
|
||||||
file:
|
file:
|
||||||
path: /var/log/ansible.run
|
path: /var/log/ansible.run
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: '0644'
|
||||||
|
user: root
|
||||||
|
group: root
|
||||||
|
@ -27,14 +27,14 @@
|
|||||||
ini_file:
|
ini_file:
|
||||||
path: /etc/NetworkManager/NetworkManager.conf
|
path: /etc/NetworkManager/NetworkManager.conf
|
||||||
state: present
|
state: present
|
||||||
no_extra_spaces: yes
|
no_extra_spaces: true
|
||||||
section: main
|
section: main
|
||||||
option: dns
|
option: dns
|
||||||
value: none
|
value: none
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
backup: yes
|
backup: true
|
||||||
notify:
|
notify:
|
||||||
- reload_networkmanager
|
- reload_networkmanager
|
||||||
|
|
||||||
@ -45,7 +45,7 @@
|
|||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
backup: yes
|
backup: true
|
||||||
notify:
|
notify:
|
||||||
- reload_networkmanager
|
- reload_networkmanager
|
||||||
|
|
||||||
@ -58,4 +58,6 @@
|
|||||||
file:
|
file:
|
||||||
path: /var/log/ansible.run
|
path: /var/log/ansible.run
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: '0644'
|
||||||
|
user: root
|
||||||
|
group: root
|
||||||
|
@ -23,18 +23,18 @@
|
|||||||
- "not no_ansible.stat.exists"
|
- "not no_ansible.stat.exists"
|
||||||
msg: "/etc/no-ansible exists - skipping run on this node"
|
msg: "/etc/no-ansible exists - skipping run on this node"
|
||||||
|
|
||||||
- name: Ensure 'dns=none' is set for Network Manager to avoid DNS servers being changed
|
- name: Ensure 'dns=none' is set for Network Manager to avoid change
|
||||||
ini_file:
|
ini_file:
|
||||||
path: /etc/NetworkManager/NetworkManager.conf
|
path: /etc/NetworkManager/NetworkManager.conf
|
||||||
state: present
|
state: present
|
||||||
no_extra_spaces: yes
|
no_extra_spaces: true
|
||||||
section: main
|
section: main
|
||||||
option: dns
|
option: dns
|
||||||
value: none
|
value: none
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
backup: yes
|
backup: true
|
||||||
notify:
|
notify:
|
||||||
- reload_networkmanager
|
- reload_networkmanager
|
||||||
|
|
||||||
@ -47,4 +47,6 @@
|
|||||||
file:
|
file:
|
||||||
path: /var/log/ansible.run
|
path: /var/log/ansible.run
|
||||||
state: touch
|
state: touch
|
||||||
|
mode: '0644'
|
||||||
|
user: root
|
||||||
|
group: root
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
name: '{{ item.key }}'
|
name: '{{ item.key }}'
|
||||||
value: '{{ item.value }}'
|
value: '{{ item.value }}'
|
||||||
state: present
|
state: present
|
||||||
ignoreerrors: yes
|
ignoreerrors: true
|
||||||
sysctl_set: yes
|
sysctl_set: true
|
||||||
sysctl_file: /etc/sysctl.d/99-ansible.conf
|
sysctl_file: /etc/sysctl.d/99-ansible.conf
|
||||||
with_dict: '{{ sysctl_config }}'
|
with_dict: '{{ sysctl_config }}'
|
||||||
tags:
|
tags:
|
||||||
@ -137,4 +137,3 @@
|
|||||||
# - restart_auditd
|
# - restart_auditd
|
||||||
# tags:
|
# tags:
|
||||||
# - harden
|
# - harden
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Ensure SSH is installed - it should be
|
|
||||||
package:
|
|
||||||
name: openssh-server
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: ssh configuration - global
|
|
||||||
block:
|
|
||||||
- name: ssh configuration - base
|
|
||||||
template:
|
|
||||||
src: "etc/ssh/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-sshd_config.j2"
|
|
||||||
dest: /etc/ssh/sshd_config
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: '0600'
|
|
||||||
validate: /usr/sbin/sshd -t -f %s
|
|
||||||
backup: yes
|
|
||||||
notify: restart_ssh
|
|
||||||
|
|
||||||
- name: ssh banner
|
|
||||||
copy:
|
|
||||||
src: "etc/rockybanner"
|
|
||||||
dest: "/etc/rockybanner"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: '0644'
|
|
||||||
notify: restart_ssh
|
|
||||||
|
|
||||||
- name: Remove dsa keys
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: absent
|
|
||||||
with_items:
|
|
||||||
- /etc/ssh/ssh_host_dsa_key.pub
|
|
||||||
- /etc/ssh/ssh_host_dsa_key
|
|
40
ansible/playbooks/tasks/ssh_config.yml
Normal file
40
ansible/playbooks/tasks/ssh_config.yml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
- name: Ensure SSH is installed - it should be
|
||||||
|
package:
|
||||||
|
name: openssh-server
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: ssh configuration - global
|
||||||
|
block:
|
||||||
|
- name: ssh configuration - base
|
||||||
|
template:
|
||||||
|
src: "etc/ssh/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-sshd_config.j2"
|
||||||
|
dest: /etc/ssh/sshd_config
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0600'
|
||||||
|
validate: /usr/sbin/sshd -t -f %s
|
||||||
|
backup: true
|
||||||
|
notify: restart_ssh
|
||||||
|
rescue:
|
||||||
|
- name: Print errors for configuration and validation
|
||||||
|
debug:
|
||||||
|
msg: "Error in configuration or template"
|
||||||
|
|
||||||
|
- name: ssh banner
|
||||||
|
copy:
|
||||||
|
src: "etc/rockybanner"
|
||||||
|
dest: "/etc/rockybanner"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
notify: restart_ssh
|
||||||
|
|
||||||
|
|
||||||
|
- name: Remove dsa keys
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
with_items:
|
||||||
|
- /etc/ssh/ssh_host_dsa_key.pub
|
||||||
|
- /etc/ssh/ssh_host_dsa_key
|
10
ansible/playbooks/vars/rdns.yml
Normal file
10
ansible/playbooks/vars/rdns.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
rdns:
|
||||||
|
- 0.1.10.in-addr.arpa.
|
||||||
|
- 2.1.10.in-addr.arpa.
|
||||||
|
- 8.1.10.in-addr.arpa.
|
||||||
|
- 14.1.10.in-addr.arpa.
|
||||||
|
- 0.16.10.in-addr.arpa.
|
||||||
|
- 2.16.10.in-addr.arpa.
|
||||||
|
- 8.16.10.in-addr.arpa.
|
||||||
|
- 14.16.10.in-addr.arpa.
|
@ -1,2 +1 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user