diff --git a/nova/core/roles/customization_single_role/README.md b/nova/core/roles/customization_single_role/README.md index 005565e9..26a92c6f 100644 --- a/nova/core/roles/customization_single_role/README.md +++ b/nova/core/roles/customization_single_role/README.md @@ -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 +``` diff --git a/nova/core/roles/customization_single_role/defaults/main.yml b/nova/core/roles/customization_single_role/defaults/main.yml new file mode 100644 index 00000000..1834c0a9 --- /dev/null +++ b/nova/core/roles/customization_single_role/defaults/main.yml @@ -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 diff --git a/nova/core/roles/customization_single_role/tasks/main.yml b/nova/core/roles/customization_single_role/tasks/main.yml index 0429b36a..3c31fa48 100644 --- a/nova/core/roles/customization_single_role/tasks/main.yml +++ b/nova/core/roles/customization_single_role/tasks/main.yml @@ -1,4 +1,12 @@ --- +- 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 }}" @@ -6,18 +14,6 @@ - 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