Added a task that draws from bootstrap role task list configuring core packages

This commit is contained in:
Alex Tavarez
2025-07-21 18:31:38 -04:00
parent 78951ddfe0
commit 46aecfffd8

View File

@@ -14,17 +14,23 @@
pre_tasks: pre_tasks:
- name: Set timezone - name: Set timezone
become: yes
become_method: sudo
community.general.timezone: community.general.timezone:
name: "{{ tzone }}" name: "{{ tzone }}"
register: timezone_set register: timezone_set
tags: ['baseconf', 'timezone_setting'] tags: ['baseconf', 'timezone_setting']
- name: Set hostname - name: Set hostname
become: yes
become_method: sudo
hostname: hostname:
name: "{{ hname }}" name: "{{ hname }}"
use: "{{ FAMILY.lower() }}" use: "{{ FAMILY.lower() }}"
register: hostname_set register: hostname_set
tags: ['baseconf', 'hostname_initialization'] tags: ['baseconf', 'hostname_initialization']
- name: Add remote host alias to hosts file - name: Add remote host alias to hosts file
become: yes
become_method: sudo
lineinfile: lineinfile:
path: /etc/hosts path: /etc/hosts
search_string: "127.0.1.1" search_string: "127.0.1.1"
@@ -34,6 +40,8 @@
register: hosts_updated register: hosts_updated
tags: ['baseconf', 'hostsfile_update'] tags: ['baseconf', 'hostsfile_update']
- name: Add remote host public address aliases to hosts file - name: Add remote host public address aliases to hosts file
become: yes
become_method: sudo
lineinfile: lineinfile:
path: /etc/hosts path: /etc/hosts
search_string: "{{ CURRENT_HOST_IP4 }}" search_string: "{{ CURRENT_HOST_IP4 }}"
@@ -44,6 +52,8 @@
when: CURRENT_HOST_IP4 is defined when: CURRENT_HOST_IP4 is defined
tags: ['baseconf', 'hostsfile_update'] tags: ['baseconf', 'hostsfile_update']
- name: Add remote host public address aliases to hosts file - name: Add remote host public address aliases to hosts file
become: yes
become_method: sudo
lineinfile: lineinfile:
path: /etc/hosts path: /etc/hosts
search_string: "{{ CURRENT_HOST_IP6 }}" search_string: "{{ CURRENT_HOST_IP6 }}"
@@ -55,15 +65,26 @@
tags: ['baseconf', 'hostsfile_update'] tags: ['baseconf', 'hostsfile_update']
tasks: tasks:
- name: Configure core packages
include_role:
name: bootstrap
tasks_from: config@corepkgs.yml
vars:
enrollment_key: "{{ crowdsec_key }}"
gcfs_password: "{{ gocrypt_password }}"
#@TODO improve filters for defining the two below variables
official_name: "{{ [admin.actual_name if admin.username == ansible_facts['user_id'] for admin in admin_auths][0] }}"
official_email: "{{ [admin.email if admin.username == ansible_facts['user_id'] for admin in admin_auths][0] }}"
homedir: "{{ ansible_facts['user_dir'] }}"
register: pkgs_configured
tags: ['default', 'configure_pkgs']
post_tasks:
- name: Do a system upgrade - name: Do a system upgrade
include_role: include_role:
name: bootstrap name: bootstrap
defaults_from: general.yml
tasks_from: "upgrade@{{ FAMILY }}.yml" tasks_from: "upgrade@{{ FAMILY }}.yml"
vars: vars:
upgrade_type: dist upgrade_type: dist
register: system_initialized register: system_initialized
tags: ['default', 'initial_system_upgrade'] tags: ['default', 'initial_system_upgrade']