Try to use set_fact for package names.

This commit is contained in:
Hyperling 2020-12-28 20:06:41 -06:00
parent b68f002e5b
commit 8eede3226b
4 changed files with 33 additions and 17 deletions

22
facts/package_name.yml Normal file
View File

@ -0,0 +1,22 @@
---
# Define what the program name is on each OS so we can use package builtin. like this:
- name: Set Pop!_OS Package Names
ansible.builtin.set_fact:
package_name.firefox: firefox
package_name.thunderbird: thunderbird
when: ansible_distribution == "Pop!OS"
- name: Set Ubuntu Package Names
ansible.builtin.set_fact:
package_name.firefox: firefox
package_name.thunderbird: thunderbird
when: ansible_distribution == "Ubuntu"
- name: Set FreeBSD Package Names
ansible.builtin.set_fact:
package_name.firefox: firefox
package_name.thunderbird: thunderbird
when: ansible_distribution == "FreeBSD"

View File

@ -1,16 +1,24 @@
---
# Harmonize my systems rather than doing everything manually. :)
# Everything
- hosts: all
connection: local
become: true
pre_tasks:
- include: facts/package_name.yml
tasks:
- include: tasks/users.yml
- include: tasks/cron.yml
- include: tasks/packages.yml
- include: tasks/harden.yml
# Desktops and laptops
- hosts: workstation
become: true
tasks:
- include: tasks/flatpaks.yml

View File

@ -13,8 +13,8 @@
- name: Remove packages that may come with an OS but are being installed as Flatpak
package:
name:
- {{ firefox[ansible_distribution] }}
- {{ thunderbird[ansible_distribution] }}
- {{ package_name.firefox }}
- {{ package_name.thunderbird }}
state: absent
- name: Install Discord

View File

@ -1,14 +0,0 @@
---
# Define what the program name is on each OS so we can use package builtin. like this:
# POP!_OS
firefox["Pop!_OS"]: firefox
thunderbird["Pop!_OS"]: thunderbird
# Ubuntu
firefox["Ubuntu"]: firefox
thunderbird["Ubuntu"]: thunderbird
# FreeBSD
firefox["FreeBSD"]: firefox
thunderbird["FreeBSD"]: thunderbird