update
This commit is contained in:
+66
-12
@@ -2,20 +2,74 @@
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: >-
|
||||
Allow mark to passwordless sudo all commands.
|
||||
(First run should be with --ask-become-pass)
|
||||
community.general.sudoers:
|
||||
name: mark-sudo
|
||||
state: present
|
||||
user: mark
|
||||
commands: ALL
|
||||
- name: Set hostname
|
||||
hostname:
|
||||
name: "{{ inventory_hostname }}"
|
||||
- name: Update debian
|
||||
- name: Print distribution
|
||||
ansible.builtin.debug:
|
||||
#var: ansible_facts ansible_distribution_release
|
||||
var: ansible_distribution_release
|
||||
- name: Add aurbis group
|
||||
ansible.builtin.group:
|
||||
name: aurbis
|
||||
state: present
|
||||
- name: Create users
|
||||
ansible.builtin.user:
|
||||
name: "{{ item }}"
|
||||
groups:
|
||||
- aurbis
|
||||
- sudo
|
||||
- wheel
|
||||
append: true
|
||||
shell: /bin/bash
|
||||
state: present
|
||||
when: users is defined
|
||||
loop: "{{ users }}"
|
||||
- name: Add IP address of relevant hosts to /etc/hosts
|
||||
lineinfile:
|
||||
dest: /etc/hosts
|
||||
regexp: ".*{{ item }}$"
|
||||
line: "{{ hostvars[item].ansible_host }} {{item}}"
|
||||
state: present
|
||||
when:
|
||||
- hostvars[item].ansible_host is defined
|
||||
- (inventory_hostname in groups['home'] and (item in groups['home'] or item in groups['cloud'])) or
|
||||
(inventory_hostname not in groups['home'] and item in groups['cloud'])
|
||||
with_items: "{{ groups.all }}"
|
||||
- name: Update Debian hosts
|
||||
hosts: debian
|
||||
become: true
|
||||
tasks:
|
||||
- name: Update
|
||||
include_tasks: tasks/update_debian.yml
|
||||
when: ansible_os_family == "Debian"
|
||||
- name: Update arch
|
||||
- name: Update Arch hosts
|
||||
hosts: arch
|
||||
become: true
|
||||
tasks:
|
||||
- name: Update
|
||||
include_tasks: tasks/update_arch.yml
|
||||
when: ansible_os_family == "Archlinux"
|
||||
- name: Docker
|
||||
hosts: debian
|
||||
become: true
|
||||
tasks:
|
||||
- name: Update
|
||||
include_tasks: tasks/install_docker_debian.yml
|
||||
- name: Add utility scripts
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Git clone
|
||||
ansible.builtin.git:
|
||||
repo: https://git.hoekveen.net/mark/scripts.git
|
||||
dest: /opt/scripts
|
||||
force: true
|
||||
- name: Set permissions and ownership for scripts folder
|
||||
file:
|
||||
path: /opt/scripts
|
||||
state: directory
|
||||
recurse: true
|
||||
group: aurbis
|
||||
mode: "0775"
|
||||
- name: Add scripts directory to safe.directory
|
||||
ansible.builtin.command:
|
||||
cmd: git config --system --add safe.directory /opt/scripts
|
||||
|
||||
Reference in New Issue
Block a user