ansible/roles/common/tasks/main.yml

64 lines
1.8 KiB
YAML
Raw Normal View History

2019-09-14 11:49:23 -05:00
#!/usr/bin/ansible-playbook
# vim:ft=ansible:
---
- name: Configure basic system settings
block:
- name: Install packages
include_tasks: packages.yml
2020-06-17 09:16:08 -05:00
- name: Copy system configs
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
loop:
- { src: "hosts", dest: "/etc/hosts", mode: "0644" }
2020-07-16 08:26:35 -05:00
- { src: "issue", dest: "/etc/issue", mode: "0644" }
2020-06-17 09:16:08 -05:00
- name: Set hostname
hostname:
name: "{{ inventory_hostname }}"
when: ansible_os_family == "Debian"
- name: Set hostname for PMOS
hostname:
name: "{{ inventory_hostname }}"
use: alpine
when: ansible_distribution == "Alpine"
- name: Set timezone
timezone:
name: "America/Chicago"
notify: restart cron
when: ansible_os_family == "Debian"
- name: Configure MOTD
block:
- name: Disable MOTD news
copy:
src: "motd-news"
dest: "/etc/default/motd-news"
2020-09-16 13:36:11 -05:00
tags: [ motd ]
- name: Disable default update-motd tasks
file:
path: "/etc/update-motd.d/{{ item }}"
state: absent
loop:
- "00-header"
- "10-help-text"
- "50-landscape-sysinfo"
- "50-motd-news"
- "80-esm"
- "80-livepatch"
- "90-updates-available"
- "91-release-upgrade"
- "92-unattended-upgrades"
- "95-hwe-eol"
- "97-overlayroot"
2020-09-16 13:36:11 -05:00
tags: [ motd ]
when: ansible_distribution == "Ubuntu"
2020-09-16 13:36:11 -05:00
- name: Add update-motd tasks
template:
src: 50-ansible-motd.sh
dest: /etc/update-motd.d/50-ansible
mode: "0755"
tags: [ motd ]
- name: Configure Ansible user
include_tasks: ansibleuser.yml
2020-06-16 09:36:36 -05:00
become: yes