Skip to content

Commit

Permalink
Merge pull request #11 from btravouillon/feat/add_packages_var
Browse files Browse the repository at this point in the history
feat: Add autoinstall meta variable packages
  • Loading branch information
btravouillon authored Oct 5, 2022
2 parents b5088b4 + 073d957 commit b4e3920
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tasks/distros.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
loop: "{{ cobbler_distros | subelements('snippets', skip_missing=True) }}"

- name: Copy per_distro snippets
ansible.builtin.copy:
content: "{{ item.1.content }}"
ansible.builtin.template:
src: per_snippet.j2
dest: "/var/lib/cobbler/snippets/per_distro/{{ item.1.name }}/{{ item.0.name }}"
owner: root
group: root
Expand Down
8 changes: 4 additions & 4 deletions tasks/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
- rhel.ks

- name: Copy custom autoinstall templates
ansible.builtin.copy:
content: "{{ item.content }}"
ansible.builtin.template:
src: templates.j2
dest: "/var/lib/cobbler/templates/{{ item.name }}"
owner: root
group: root
Expand Down Expand Up @@ -69,8 +69,8 @@
label: "Create directory /var/lib/cobbler/snippets/per_profile/{{ item.1.name }}"

- name: Copy per_profile snippets
ansible.builtin.copy:
content: "{{ item.1.content }}"
ansible.builtin.template:
src: per_snippet.j2
owner: root
group: root
mode: '0644'
Expand Down
4 changes: 2 additions & 2 deletions tasks/repositories-Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
keyring: /etc/apt/trusted.gpg.d/cobbler.gpg

- name: Configure Cobbler repository
ansible.builtin.copy:
content: "{{ cobbler_apt_repository }}\n"
ansible.builtin.template:
src: apt_repository.j2
dest: /etc/apt/sources.list.d/cobbler.list
owner: root
group: root
Expand Down
4 changes: 2 additions & 2 deletions tasks/systems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
loop: "{{ cobbler_systems | subelements('snippets', skip_missing=True) }}"

- name: Copy per_system snippets
ansible.builtin.copy:
content: "{{ item.1.content }}"
ansible.builtin.template:
src: per_snippet.j2
dest: "/var/lib/cobbler/snippets/per_system/{{ item.1.name }}/{{ item.0.name }}"
owner: root
group: root
Expand Down
1 change: 1 addition & 0 deletions templates/apt_repository.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ cobbler_apt_repository }}
1 change: 1 addition & 0 deletions templates/per_snippet.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ item.1.content }}
3 changes: 3 additions & 0 deletions templates/snippets/custom_post_install.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
{{ cobbler_custom_post_install }}
{% else %}
# Define your custom script with variable `cobbler_custom_post_install`.
#if $getVar('packages', '') != ''
sudo apt install -y $packages
#end if
{% endif %}
1 change: 1 addition & 0 deletions templates/templates.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ item.content }}
3 changes: 3 additions & 0 deletions templates/templates/rhel.ks.j2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ $SNIPPET('pre_anamon')
%packages
openssh-server
sudo
#if $getVar('packages', '') != ''
$packages
#end if
%end

%post --nochroot
Expand Down

0 comments on commit b4e3920

Please sign in to comment.