|
132 | 132 | advanced: true
|
133 | 133 | value_type: plain
|
134 | 134 | hidden_value: false
|
135 |
| - template: | |
136 |
| - --- |
137 |
| - - hosts: all |
138 |
| - tasks: |
139 |
| - - command: ansible-galaxy install {{ item }} -p <%= input('location').present? ? input('location') : '/etc/ansible/roles' %> |
140 |
| - register: out |
141 |
| - with_items: |
142 |
| - - <%= input('ansible_roles_list') %> |
143 |
| - - debug: var=out |
| 135 | + # |
| 136 | + # This is a hack because i am too lazy to look up how to use /files/ properly. |
| 137 | + # I'm only doing it for the affected templates and not all of them. |
| 138 | + # |
| 139 | + # All of these templates are somewhat an artifact of bootstrapping foreman and will |
| 140 | + # we removed when we're closer to v1. |
| 141 | + # |
| 142 | + # TODO: get rid of ugly hack |
| 143 | + file_name: /etc/ansible/collections/ansible_collections/radiorabe/rabe_foreman/roles/foreman/files/ansible_roles__install_from_galay.erb |
144 | 144 | - name: Ansible Roles - Install from git
|
145 | 145 | state: present
|
146 | 146 | description_format: 'Clone roles from git repository to %{location}'
|
|
251 | 251 | advanced: false
|
252 | 252 | value_type: plain
|
253 | 253 | hidden_value: false
|
254 |
| - template: | |
255 |
| - --- |
256 |
| - - hosts: all |
257 |
| - tasks: |
258 |
| - - name: Gather the rpm package facts |
259 |
| - package_facts: |
260 |
| - manager: auto |
261 |
| -
|
262 |
| - - name: Fail if the target server is a Satellite server |
263 |
| - fail: |
264 |
| - msg: "This playbook cannot be executed on a Satellite server. Use only on a Capsule server." |
265 |
| - when: "'satellite' in ansible_facts.packages" |
266 |
| -
|
267 |
| - - name: Install|Update satellite-maintain if not present |
268 |
| - package: |
269 |
| - name: rubygem-foreman_maintain |
270 |
| - state: latest |
271 |
| -
|
272 |
| - - block: |
273 |
| - <%- whitelist_option = if input('whitelist_options').present? |
274 |
| - "--whitelist=#{input('whitelist_options')}" |
275 |
| - end -%> |
276 |
| - - name: Upgrade Capsule server using satellite-maintain |
277 |
| - shell: satellite-maintain upgrade run --assumeyes --target-version=<%= input('target_version') %> <%= whitelist_option %> |
278 |
| - register: result |
279 |
| -
|
280 |
| - - name: Re-Gather the rpm package facts after the upgrade |
281 |
| - package_facts: |
282 |
| - manager: auto |
283 |
| -
|
284 |
| - - name: satellite-maintain upgrade return code is zero |
285 |
| - debug: |
286 |
| - msg: "Success! Capsule server upgrade completed. Current version of Capsule server server is {{ ansible_facts.packages['satellite-capsule'][0]['version'] }}." |
287 |
| -
|
288 |
| - rescue: |
289 |
| - - name: Print satellite-maintain output |
290 |
| - debug: |
291 |
| - var: result |
292 |
| -
|
293 |
| - - name: Grep top 10 Error messages from /var/log/foreman-installer/capsule.log |
294 |
| - shell: grep '^\[ERROR' /var/log/foreman-installer/capsule.log | head -n10 |
295 |
| - register: output_grep |
296 |
| -
|
297 |
| - - name: Print grepped Error messages |
298 |
| - debug: |
299 |
| - var: output_grep.stdout_lines |
300 |
| -
|
301 |
| - - name: satellite-maintain upgrade return code is non-zero |
302 |
| - fail: |
303 |
| - msg: "Failed! Capsule server upgrade failed. See /var/log/foreman-installer/capsule.log in the Capsule server for more information" |
| 254 | + # TODO: get rid of ugly hack |
| 255 | + file_name: /etc/ansible/collections/ansible_collections/radiorabe/rabe_foreman/roles/foreman/files/capsule_upgrade_playbook.erb |
304 | 256 | - name: Change content source
|
305 | 257 | state: present
|
306 | 258 | description_format: Configure subscription manager to new content source
|
|
770 | 722 | advanced: false
|
771 | 723 | value_type: plain
|
772 | 724 | hidden_value: false
|
773 |
| - template: | |
774 |
| - - hosts: all |
775 |
| - vars: |
776 |
| - updates: [] |
777 |
| - <% if input('state').blank? %> |
778 |
| - state: searched |
779 |
| - <% else %> |
780 |
| - state: <%= input('state') %> |
781 |
| - <% end %> |
782 |
| -
|
783 |
| - tasks: |
784 |
| - - name: "{{ state | replace('ed','') | capitalize }} Windows Updates" |
785 |
| - win_updates: |
786 |
| - <% unless input('reject_list').blank? %> |
787 |
| - blacklist: <%= input('reject_list') %> |
788 |
| - <% end -%> |
789 |
| - <% if input('category_names').blank? %> |
790 |
| - category_names: ["CriticalUpdates", "SecurityUpdates", "UpdateRollups"] |
791 |
| - <% else %> |
792 |
| - category_names: <%= input('category_names') %> |
793 |
| - <% end %> |
794 |
| - <% unless input('log_path').blank? %> |
795 |
| - log_path: <%= input('log_path') %> |
796 |
| - <% end -%> |
797 |
| - <% if input('reboot').blank? %> |
798 |
| - reboot: false |
799 |
| - <% else %> |
800 |
| - reboot: <%= input('reboot') %> |
801 |
| - <% end %> |
802 |
| - <% if input('reboot_timeout').blank? %> |
803 |
| - reboot_timeout: 1200 |
804 |
| - <% else %> |
805 |
| - reboot_timeout: <%= input('reboot_timeout') %> |
806 |
| - <% end -%> |
807 |
| - <% if input('server_selection').blank? %> |
808 |
| - server_selection: default |
809 |
| - <% else %> |
810 |
| - server_selection: <%= input('server_selection') %> |
811 |
| - <% end %> |
812 |
| - state: "{{ state }}" |
813 |
| - <% if input('use_scheduled_task').blank? %> |
814 |
| - use_scheduled_task: false |
815 |
| - <% else %> |
816 |
| - use_scheduled_task: <%= input('use_scheduled_task') %> |
817 |
| - <% end %> |
818 |
| - <% if !input('whitelist').blank? %> |
819 |
| - whitelist: <%= input('whitelist') %> |
820 |
| - <% end -%> |
821 |
| -
|
822 |
| - register: found_updates |
823 |
| -
|
824 |
| - - name: "Get all {{ state }} updates" |
825 |
| - set_fact: |
826 |
| - updates: "{{ updates + [ current_update ] }}" |
827 |
| - vars: |
828 |
| - current_update: "{{ item.value.title }}" |
829 |
| - loop: "{{ found_updates.updates | dict2items }}" |
830 |
| - no_log: true |
831 |
| -
|
832 |
| - - name: "List {{ state }} Windows Updates" |
833 |
| - debug: |
834 |
| - msg: "{{ item }}" |
835 |
| - loop: "{{ updates }}" |
| 725 | + # TODO: get rid of ugly hack |
| 726 | + file_name: /etc/ansible/collections/ansible_collections/radiorabe/rabe_foreman/roles/foreman/files/manage_windows_updates.erb |
836 | 727 | - name: Module Action - Ansible Default
|
837 | 728 | state: present
|
838 | 729 | description_format: 'Module %{action} %{module_spec}'
|
|
0 commit comments