From fdfe9374627bea900d9c3124ce8177904f52bb44 Mon Sep 17 00:00:00 2001 From: ipvsean Date: Mon, 24 Feb 2020 14:29:00 -0500 Subject: [PATCH] MVP --- .gitignore | 2 ++ README.md | 8 ++++- docs/contribute.md | 9 ++++++ playbooks/deploy_application.yml | 10 ++++++ .../tasks/deploy_application.yml | 31 +++++++++++++++++++ roles/deploy_application/tasks/main.yml | 18 +++++++++++ tower_login_info.yml | 3 ++ 7 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 docs/contribute.md create mode 100644 playbooks/deploy_application.yml create mode 100644 roles/deploy_application/tasks/deploy_application.yml create mode 100644 roles/deploy_application/tasks/main.yml create mode 100644 tower_login_info.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2354643 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +sean_login_info.yml diff --git a/README.md b/README.md index e52ca81..b387954 100644 --- a/README.md +++ b/README.md @@ -1 +1,7 @@ -# product-demos \ No newline at end of file +# Official Ansible Product Demos + +this is currently under construction and working on a minimal viable demo for testing purposes + +# Contribute + +please refer to the [contribute.md](docs/contribute.md) documentation included in this collection. diff --git a/docs/contribute.md b/docs/contribute.md new file mode 100644 index 0000000..0d663a2 --- /dev/null +++ b/docs/contribute.md @@ -0,0 +1,9 @@ +# Contribute + +This project is **not** currently taking PRs (pull requests) or code contributions. This is currently a work in progress and not at a point that would make sense to take contributions. Please try to make PRs into [ansible-examples](https://github.com/ansible/ansible-examples) if you want to showcase Ansible Playbooks or roles. + +# Going Further + +The following links will be helpful if you want to contribute code to the Ansible Workshops project, or any Ansible project: +- [Ansible Committer Guidelines](http://docs.ansible.com/ansible/latest/committer_guidelines.html) +- [Learning Git](https://git-scm.com/book/en/v2) diff --git a/playbooks/deploy_application.yml b/playbooks/deploy_application.yml new file mode 100644 index 0000000..5ce6166 --- /dev/null +++ b/playbooks/deploy_application.yml @@ -0,0 +1,10 @@ +--- +- name: setup deploy_application.yml demo + hosts: localhost + gather_facts: false + become: yes + tasks: + + - name: Conditional role + include_role: + name: "{{playbook_dir}}/../deploy_application" diff --git a/roles/deploy_application/tasks/deploy_application.yml b/roles/deploy_application/tasks/deploy_application.yml new file mode 100644 index 0000000..0d07bf2 --- /dev/null +++ b/roles/deploy_application/tasks/deploy_application.yml @@ -0,0 +1,31 @@ +--- +- name: application deployment + hosts: webservers + gather_facts: false + become: yes + tasks: + - name: make sure application is not empty + assert: + that: + - "application != ''" + + - name: printing to terminal application information + debug: + msg: "This Ansible Playbook will install {{application}}" + + - name: install application + yum: + name: "{{application}}" + use_backend: yum + allow_downgrade: true + register: result + + - name: printing to terminal application information + debug: + msg: "The application: {{application}} has been installed" + when: result.changed|bool + + - name: printing to terminal application information + debug: + msg: "The application: {{application}} was already installed" + when: not result.changed|bool diff --git a/roles/deploy_application/tasks/main.yml b/roles/deploy_application/tasks/main.yml new file mode 100644 index 0000000..6e9e07c --- /dev/null +++ b/roles/deploy_application/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: setup deploy_application.yml demo + hosts: localhost + gather_facts: false + become: yes + tasks: + + - name: add tower project + tower_project: + name: "Ansible official demo project" + description: "prescriptive demos from Red Hat Management Buisness Unit" + organization: "Default" + scm_type: git + scm_url: https://github.com/ansible/product-demos + tower_username: "{{my_tower_username}}" + tower_password: "{{my_tower_password}}" + tower_host: "{{my_tower_host}}" + validate_certs: no diff --git a/tower_login_info.yml b/tower_login_info.yml new file mode 100644 index 0000000..fdc6520 --- /dev/null +++ b/tower_login_info.yml @@ -0,0 +1,3 @@ +my_tower_username: colin +my_tower_password: mahalo +my_tower_host: test.rhdemo.io