Skip to content

Commit

Permalink
Fix lowercase task names
Browse files Browse the repository at this point in the history
  • Loading branch information
martignoni committed Sep 11, 2022
1 parent 1e14bc9 commit c9125d8
Show file tree
Hide file tree
Showing 37 changed files with 144 additions and 144 deletions.
10 changes: 5 additions & 5 deletions buildmoodlebox.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: playbook to provision most of the MoodleBox
- name: Playbook to provision most of the MoodleBox
hosts: all
vars:
ansible_user: 'root'
Expand All @@ -10,21 +10,21 @@
- default.config.yml

pre_tasks:
- name: print out begin of build date and time
- name: Print out begin of build date and time
ansible.builtin.debug:
msg: 'Beginning of build: {{ lookup("pipe", "date +%Y-%m-%dT%H:%M:%S%z") }}'

- name: set fact with build start timestamp
- name: Set fact with build start timestamp
ansible.builtin.set_fact:
build_start: '{{ lookup("pipe", "date +%s") }}'

- name: include customised variables
- name: Include customised variables
ansible.builtin.include_vars: '{{ item }}'
with_fileglob:
- config.yml

post_tasks:
- name: print out end of build date and time and build duration
- name: Print out end of build date and time and build duration
ansible.builtin.debug:
msg:
- 'End of build: {{ lookup("pipe", "date +%Y-%m-%dT%H:%M:%S%z") }}'
Expand Down
6 changes: 3 additions & 3 deletions installsshkeys.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---

- name: playbook to get SSH public key into root account
- name: Playbook to get SSH public key into root account
hosts: all

vars_files:
- default.config.yml

pre_tasks:
- name: include customised variables
- name: Include customised variables
ansible.builtin.include_vars: '{{ item }}'
with_fileglob:
- config.yml

tasks:
- name: install SSH public key to root user
- name: Install SSH public key to root user
become: true
ansible.posix.authorized_key:
user: root
Expand Down
16 changes: 8 additions & 8 deletions roles/accesspoint/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: install packages for AP mode
- name: Install packages for AP mode
ansible.builtin.apt:
pkg: '{{ item }}'
state: 'present'
Expand All @@ -12,7 +12,7 @@
register: access_point_mode_packages_installed
until: access_point_mode_packages_installed is succeeded

- name: configure dhcpcd with static IP address {{ moodlebox_ip_address | ansible.utils.ipaddr('host') }}
- name: Configure dhcpcd with static IP address {{ moodlebox_ip_address | ansible.utils.ipaddr('host') }}
ansible.builtin.blockinfile:
path: '/etc/dhcpcd.conf'
block: |
Expand All @@ -25,35 +25,35 @@
nohook wpa_supplicant
notify: restart networking

- name: update access point configuration file
- name: Update access point configuration file
ansible.builtin.template:
src: 'etc/hostapd/hostapd.conf.j2'
dest: '/etc/hostapd/hostapd.conf'
mode: '0644'
notify: restart networking

- name: update access point settings
- name: Update access point settings
ansible.builtin.lineinfile:
path: '/etc/default/hostapd'
regexp: '^#?DAEMON_CONF'
line: 'DAEMON_CONF="/etc/hostapd/hostapd.conf"'
notify: restart networking

- name: unmask, enable and start hostapd
- name: Unmask, enable and start hostapd
ansible.builtin.systemd:
name: 'hostapd'
state: 'started'
enabled: 'yes'
masked: 'no'

- name: update dnsmasq configuration
- name: Update dnsmasq configuration
ansible.builtin.template:
src: 'etc/dnsmasq.conf.j2'
dest: '/etc/dnsmasq.conf'
mode: '0664'
notify: restart networking

- name: update dnsmasq service file
- name: Update dnsmasq service file
ansible.builtin.blockinfile:
path: '/lib/systemd/system/dnsmasq.service'
insertbefore: '^\[Install\]\s*$'
Expand All @@ -62,5 +62,5 @@
Restart=on-failure
notify: restart networking

- name: flush handlers
- name: Flush handlers
ansible.builtin.meta: flush_handlers
2 changes: 1 addition & 1 deletion roles/adminer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: install adminer latest release
- name: Install adminer latest release
ansible.builtin.get_url:
url: 'https://www.adminer.org/latest.php'
dest: '{{ moodlebox_moodle_source_dir }}/adminer.php'
Expand Down
2 changes: 1 addition & 1 deletion roles/apt/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: update apt cache and upgrade
- name: Update apt cache and upgrade
ansible.builtin.apt:
update_cache: 'yes'
upgrade: 'dist'
Expand Down
14 changes: 7 additions & 7 deletions roles/branding/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
---

- name: read reference image version from '/boot/issue.txt'
- name: Read reference image version from '/boot/issue.txt'
ansible.builtin.slurp:
src: /boot/issue.txt
register: issuefile

- name: set 'referenceimage' variable
- name: Set 'referenceimage' variable
ansible.builtin.set_fact:
referenceimage: "{{ issuefile['content'] | b64decode | regex_findall('^(.*)\\n') | first }}"

- name: write version file
- name: Write version file
ansible.builtin.template:
src: 'etc/moodlebox-info.j2'
dest: '/etc/{{ moodlebox_info_file }}'
mode: '0644'

- name: copy version file to boot partition
- name: Copy version file to boot partition
ansible.builtin.copy:
src: '/etc/{{ moodlebox_info_file }}'
dest: '/boot/{{ moodlebox_info_file }}.txt'
mode: '0644'
remote_src: true

- name: update motd
- name: Update motd
ansible.builtin.template:
src: 'etc/motd.j2'
dest: '/etc/motd'
mode: '0644'

- name: copy ascii logo file
- name: Copy ascii logo file
ansible.builtin.copy:
src: 'etc/moodlebox-logo.txt'
dest: '/etc/{{ moodlebox_logo_file }}'
mode: '0644'

- name: copy script to display ascii logo
- name: Copy script to display ascii logo
ansible.builtin.template:
src: 'etc/update-motd.d/20-logo.j2'
dest: '/etc/update-motd.d/20-logo'
Expand Down
2 changes: 1 addition & 1 deletion roles/cert/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: copy root CA certificate
- name: Copy root CA certificate
ansible.builtin.copy:
src: 'home/files/moodleboxCA.crt'
dest: '/home/{{ moodlebox_username }}/files/moodleboxCA.crt'
Expand Down
6 changes: 3 additions & 3 deletions roles/cleanup/tasks/cleandirfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

# See https://stackoverflow.com/a/35128533
# See https://wrightturn.wordpress.com/2017/05/10/ansible-warning-the-loop-variable-item-is-already-in-use/
- name: define outer loop
- name: Define outer loop
ansible.builtin.set_fact:
outer_loop: '{{ item }}'

- name: find files
- name: Find files
ansible.builtin.find:
paths: '{{ outer_loop }}'
pattern: '*'
file_type: any
register: dir_content

- name: remove temp directories and files
- name: Remove temp directories and files
ansible.builtin.file:
path: '{{ file_item.path }}'
state: absent
Expand Down
20 changes: 10 additions & 10 deletions roles/cleanup/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: remove packages used only during the build
- name: Remove packages used only during the build
ansible.builtin.apt:
pkg: '{{ packages }}'
state: 'absent'
Expand All @@ -10,7 +10,7 @@
- 'python3-pymysql'
- 'rpi-update'

- name: clean Moodle database log tables
- name: Clean Moodle database log tables
ansible.builtin.command: mysql -e 'TRUNCATE TABLE {{ moodlebox_moodle_db }}.{{ item }}'
with_items:
- 'mdl_config_log'
Expand All @@ -19,24 +19,24 @@
- 'mdl_upgrade_log'
when: moodle_db_created is succeeded

- name: remove useless packages from cache and no longer required dependencies
- name: Remove useless packages from cache and no longer required dependencies
ansible.builtin.apt:
autoremove: 'yes'
autoclean: 'yes'
register: useless_packages_removed
until: useless_packages_removed is succeeded

- name: stop DHCP server
- name: Stop DHCP server
ansible.builtin.systemd:
name: 'dnsmasq'
state: 'stopped'

- name: cleanup DHCP leases
- name: Cleanup DHCP leases
ansible.builtin.file:
path: '/var/lib/misc/dnsmasq.leases'
state: 'absent'

- name: cleanup dirs and files
- name: Cleanup dirs and files
ansible.builtin.include_tasks: cleandirfile.yml
with_items:
- '{{ moodlebox_moodle_data_dir }}/cache/cachestore_file'
Expand All @@ -55,23 +55,23 @@
- '/root/.mysql_history'
- '/root/.nano_history'

- name: find log files to truncate
- name: Find log files to truncate
ansible.builtin.find:
paths: '/var/log'
recurse: 'yes'
register: log_files

- name: empty log files
- name: Empty log files
ansible.builtin.command: 'truncate --size 0 {{ item.path }}'
with_items:
- '{{ log_files.files }}'
register: log_files_emptied
changed_when: log_files_emptied.rc == 0

- name: reboot box
- name: Reboot box
ansible.builtin.reboot:

- name: remove ssh public keys
- name: Remove ssh public keys
ansible.builtin.file:
path: '/root/.ssh'
state: 'absent'
Expand Down
8 changes: 4 additions & 4 deletions roles/cron/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: configure timely cron
- name: Configure timely cron
ansible.builtin.cron:
name: '{{ item.name }}'
minute: '{{ item.minute }}'
Expand All @@ -9,7 +9,7 @@
- { name: 'Launch Moodle tasks', minute: '*', job: 'nice -n10 ionice -c2 /usr/bin/php {{ moodlebox_moodle_source_dir }}/admin/cli/cron.php' }
- { name: 'Backup cache', minute: '*/20', job: 'rsync -a --delete /var/cache/moodle/ /var/cache/moodle-cache-backup/' }

- name: configure special time cron
- name: Configure special time cron
ansible.builtin.cron:
name: '{{ item.name }}'
special_time: '{{ item.special_time }}'
Expand All @@ -20,14 +20,14 @@
# this long line is OK
- { name: 'Ensure minimal wireless firmware is used', special_time: 'reboot', job: 'ln -sf /lib/firmware/cypress/cyfmac43455-sdio-minimal.bin /lib/firmware/brcm/brcmfmac43455-sdio.bin' }

- name: configure direvent
- name: Configure direvent
ansible.builtin.template:
src: 'etc/direvent.conf.j2'
dest: '/etc/direvent.conf'
mode: '0644'
register: direvent_configured

- name: configure cron mailto variable to suppress warnings in log
- name: Configure cron mailto variable to suppress warnings in log
cronvar:
name: MAILTO
value: '""'
12 changes: 6 additions & 6 deletions roles/database/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

- name: configure MariaDB root password
- name: Configure MariaDB root password
ansible.builtin.debconf:
name: 'mariadb-server'
question: '{{ item }}'
Expand All @@ -11,36 +11,36 @@
- 'mysql-server/root_password_again'
register: configure_mariadb_install

- name: install MariaDB
- name: Install MariaDB
ansible.builtin.apt:
pkg: 'mariadb-server'
state: 'present'
when: configure_mariadb_install is successful
register: install_mariadb
until: install_mariadb is succeeded

- name: install python3-pymysql
- name: Install python3-pymysql
ansible.builtin.apt:
pkg: 'python3-pymysql'
state: 'present'
register: pymysql_installed
until: pymysql_installed is succeeded

- name: add '{{ moodlebox_db_username }}' MariaDB user with all privileges
- name: Add '{{ moodlebox_db_username }}' MariaDB user with all privileges
community.mysql.mysql_user:
name: '{{ moodlebox_db_username }}'
password: '{{ moodlebox_db_password }}'
login_unix_socket: '/var/run/mysqld/mysqld.sock'
priv: '*.*:ALL,GRANT'
no_log: true

- name: update MariaDB settings
- name: Update MariaDB settings
ansible.builtin.copy:
src: 'etc/mysql/mariadb.conf.d/50-server.cnf'
dest: '/etc/mysql/mariadb.conf.d/50-server.cnf'
mode: '0644'

- name: restart MariaDB database
- name: Restart MariaDB database
ansible.builtin.systemd:
name: 'mariadb'
state: 'restarted'

0 comments on commit c9125d8

Please sign in to comment.