diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 8d13d57..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -collections/* -!collections/requirements.yml -secrets/* \ No newline at end of file diff --git a/GCP_VM_Create.yml b/GCP_VM_Create.yml deleted file mode 100644 index 9782ed2..0000000 --- a/GCP_VM_Create.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- -- name: Create an VM instance - hosts: localhost - connection: local - gather_facts: no - vars: - gcp_project: ceenter - zone: "europe-west3-a" - region: "europe-west3" - - tasks: - - name: create a disk - gcp_compute_disk: - name: "{{ vm_disk_name | default('ansible-tower-test-disk', true) }}" - size_gb: 50 - source_image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts' - zone: "{{ zone }}" - project: "{{ gcp_project }}" - state: present - register: disk - - name: create a address - gcp_compute_address: - name: "{{ vm_address_name | default('ansible-tower-test-address', true) }}" - region: "{{ region }}" - project: "{{ gcp_project }}" - state: present - register: address - - name: create a instance - gcp_compute_instance: - state: present - name: "{{ vm_name | default('ansible-tower-test', true) }}" - machine_type: n1-standard-1 - disks: - - auto_delete: true - boot: true - source: "{{ disk }}" - network_interfaces: - - network: null # use default - access_configs: - - name: 'External NAT' - nat_ip: "{{ address }}" - type: 'ONE_TO_ONE_NAT' - zone: "{{ zone }}" - project: "{{ gcp_project }}" diff --git a/GCP_VM_Delete.yml b/GCP_VM_Delete.yml deleted file mode 100644 index 2fe2f1c..0000000 --- a/GCP_VM_Delete.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Delete an VM instance - hosts: localhost - connection: local - gather_facts: no - vars: - gcp_project: ceenter - scopes: - - https://www.googleapis.com/auth/compute - zone: "europe-west3-a" - region: "europe-west3" - - tasks: - - name: delete an instance - gcp_compute_instance: - state: absent - name: "{{ vm_name | default('ansible-tower-test', true) }}" - zone: "{{ zone }}" - project: "{{ gcp_project }}" diff --git a/README.md b/README.md index b1c3b3f..bd3b7c6 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,3 @@ # Technical Technical repo for Ceenter infrastructure - -## Local setup - -Steps to prepare local environment. - -### Prerequisites - -ansible 2.9+ - -### Install Ansible collections - -Configure ansible.cfg: -Download ansible-hub token from https://cloud.redhat.com/ansible/automation-hub/token - -update ansible.cfg to include: -``` ini -[defaults] -collections_paths = ./collections - -[galaxy] -server_list = automation_hub - -[galaxy_server.automation_hub] -url=https://cloud.redhat.com/api/automation-hub/ -auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token -token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -``` - -Install dependent collections -```shell -ansible-galaxy collection install -r ./collections/requirements.yml -``` - -Detailed [blog about setting up env](https://www.ansible.com/blog/hands-on-with-ansible-collections) for automation-hub collections. - -Install google.cloud requirements: - -``` shell -yum install python-requests -pip install requests google-auth -``` - -Download [GCP credentials](https://docs.ansible.com/ansible/latest/scenario_guides/guide_gce.html#credentials). - -### Create VM on GCP - -``` shell -ansible-playbook GCP_VM_Create.yml -``` - -## Ansible Tower Setup - -Create Credential: -- GCP connection -- Github -- RHV - -Create Project: -- technical - -Create Job Templates: -- GCP Create VM -- RHV Create VM - -Authenticate Ansible Tower to Automation-hub: -- Retrieve token at https://cloud.redhat.com/ansible/automation-hub/token -- Update token in Ansible Tower: https://www.ansible.com/blog/installing-and-using-collections-on-ansible-tower diff --git a/RHV_VM_Create.yml b/RHV_VM_Create.yml deleted file mode 100644 index 7388157..0000000 --- a/RHV_VM_Create.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Provision VM from template - hosts: localhost - connection: local - gather_facts: no - - vars: -# datacenter: Default - - tasks: - - - name: Create and run RHEL VM from template - ovirt_vm: - name: "{{ vm_name | default('test0002', true) }}" - template: default_template - cluster: "{{ cluster | default('Default', true) }}" - memory: "{{vm_memory | default('1GiB', true) }}" - high_availability: true - description: "{{ description | default(omit) }}" - state: running - wait: yes diff --git a/ansible.cfg b/ansible.cfg deleted file mode 100644 index 9feb9fe..0000000 --- a/ansible.cfg +++ /dev/null @@ -1,15 +0,0 @@ -# config file for ansible -- https://ansible.com/ -# =============================================== - -# nearly all parameters can be overridden in ansible-playbook -# or with command line flags. ansible will read ANSIBLE_CONFIG, -# ansible.cfg in the current working directory, .ansible.cfg in -# the home directory or /etc/ansible/ansible.cfg, whichever it -# finds first - -[defaults] -collections_paths = ./collections -stdout_callback = yaml -callback_whitelist = yaml -bin_ansible_callbacks = True -nocows = 1 diff --git a/collections/requirements.yml b/collections/requirements.yml deleted file mode 100644 index 86c7f8c..0000000 --- a/collections/requirements.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -collections: - - name: google.cloud - source: https://cloud.redhat.com/api/automation-hub/ - version: 1.0.0 \ No newline at end of file diff --git a/test.yml b/test.yml deleted file mode 100644 index 2e134d1..0000000 --- a/test.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Test Playbook - hosts: all - gather_facts: no - connection: local - - tasks: - - name: Tell me all about yourself - setup: - register: fact_variable - - - name: Show it on screen - debug: - msg: "{{ fact_variable }}"