Skip to content

Commit

Permalink
Made sure that post_scripts_folder_on_target get's created in `cust…
Browse files Browse the repository at this point in the history
…omization_single_role`
  • Loading branch information
AllRWeak authored and bl0way committed Feb 21, 2024
1 parent 2287663 commit 5ce8175
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 36 deletions.
34 changes: 10 additions & 24 deletions nova/core/roles/customization_single_role/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
# Role Name
# customization_single_role

COMING SOON
A brief description of the role goes here.
This is a role to include and run a single Ansible role. The role name can be in the for of path/to/role or the FQCN of the role.

## Requirements

COMING SOON
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
none

## Role Variables

COMING SOON
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
`single_role` variable is required to be set to the name of the role you want to include and run.

## Dependencies

COMING SOON
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
none

## Example Playbook
## Example

COMING SOON
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
Include and run the `nova.core.updates` from command line by appending the cli variable to your playbook command:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

## License

AGPL-3.0-or-later

## Author Information

COMING SOON
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
```bash
ansible-playbook -i inventory playbook.yml -e single_role=nova.core.updates
```
2 changes: 2 additions & 0 deletions nova/core/roles/customization_single_role/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
post_scripts_folder_on_target: C:\tmp # This is the folder where the post scripts will be stored on the target machine
20 changes: 8 additions & 12 deletions nova/core/roles/customization_single_role/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
---
- name: Creating {{ post_scripts_folder_on_target }} folder...
ansible.windows.win_file:
path: "{{ post_scripts_folder_on_target }}"
state: directory
when:
- ansible_network_os is not defined
- ansible_system == "Win32NT"

- name: Including {{ single_role }} role...
ansible.builtin.include_role:
name: "{{ single_role }}"

- name: Flushing handlers...
ansible.builtin.meta: flush_handlers

- name: Rebooting...
ansible.builtin.reboot:
when:
- reboot_on_finalize
- ansible_system == "Linux"

- name: Rebooting...
ansible.windows.win_reboot:
when:
- reboot_on_finalize
- ansible_system == "Win32NT"

- name: Including get_ip role...
ansible.builtin.include_role:
name: nova.core.get_ip
Expand Down

0 comments on commit 5ce8175

Please sign in to comment.