fix(actions): Adds actions to lint ansible and yaml

This commit is contained in:
Thomas Maurice 2024-02-20 18:17:02 +01:00
parent d20db64817
commit 43e7b6850d
Signed by: thomas
GPG key ID: 1D577F50583032A6
17 changed files with 303 additions and 38 deletions

View file

@ -13,7 +13,7 @@
# the packages you want to install just as you would pass them
# to `apt install`.
- name: "Install wanted packages"
apt:
ansible.builtin.apt:
name:
- apt-transport-https
- arptables
@ -70,7 +70,7 @@
- zip
# state: latest will update the package everytime the
# role is ran against a host
state: latest
state: present
# Update the cache before trying to update ?
# You generally want this because it's not updating itself
update_cache: true
@ -82,7 +82,7 @@
until: apt_res is success
# Same as above, except you *remove* packages instead of installing them
- name: "Remove unanted packages"
apt:
ansible.builtin.apt:
name:
- ntpdate
# note the value of `state` here
@ -91,7 +91,7 @@
# that is golbally available. It will map to the hostname you
# assigned your host in the `inventory` file
- name: "Hard set hostname"
template:
ansible.builtin.template:
src: hostname.j2
dest: /etc/hostname
owner: root
@ -101,14 +101,14 @@
# more info https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html#parameter-mode
mode: "0644"
- name: "Setup motd"
template:
ansible.builtin.template:
src: motd.j2
dest: /etc/motd
owner: root
group: root
mode: "0644"
- name: "Setup hosts"
template:
ansible.builtin.template:
src: hosts.j2
dest: /etc/hosts
owner: root

View file

@ -3,6 +3,6 @@
# in this example you want to invoke this restart handler when the
# configuration of the service changes for example.
- name: "Restart ntp"
service:
ansible.builtin.service:
name: ntp
state: restarted

View file

@ -1,10 +1,10 @@
---
- name: "Install ntp"
apt:
ansible.builtin.apt:
name: ntp
state: present
- name: "Configure ntp"
copy:
ansible.builtin.copy:
src: ntp.conf
dest: /etc/ntp.conf
owner: root
@ -17,8 +17,8 @@
notify: "Restart ntp"
# Here you say that you want the NTP service to be restarted as well
# as enabled on boot.
- name: "ntp service"
service:
- name: "NTP service"
ansible.builtin.service:
name: ntp
state: restarted
enabled: true

View file

@ -1,14 +1,14 @@
---
# Ensures the .ssh directory exists
- name: "creates the .ssh root directory"
file:
- name: "Creates the .ssh root directory"
ansible.builtin.file:
path: "/root/.ssh"
state: directory
owner: root
group: root
mode: 0700
- name: "Install root SSH keys"
template:
ansible.builtin.template:
src: authorized_keys.j2
dest: /root/.ssh/authorized_keys
owner: root
@ -17,8 +17,8 @@
# Delete users you don't need
# respectively you can also *add* users
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/user_module.html#ansible-collections-ansible-builtin-user-module
- name: "Delete usual cloud users user"
user:
- name: "Delete usual cloud users user" # noqa: loop-var-prefix
ansible.builtin.user:
name: "{{ item }}"
state: absent
remove: true

View file

@ -1,12 +1,13 @@
---
- name: Install vim
apt:
ansible.builtin.apt:
name: vim-nox
state: latest
state: present
# use the `copy` module to copy files to the remote host
- name: Configure vim
copy:
ansible.builtin.copy:
src: vimrc
dest: /etc/vim/vimrc
owner: root
group: root
mode: "0650"