updated merge
diff --git a/.gitignore b/.gitignore index 48dcfc1..8160975 100644 --- a/.gitignore +++ b/.gitignore
@@ -113,3 +113,5 @@ *.db *~ ansible.cfg +backups +
diff --git a/README-CUSTOM-PROPERTIES.md b/README-CUSTOM-PROPERTIES.md index 16bf065..2fe1c33 100644 --- a/README-CUSTOM-PROPERTIES.md +++ b/README-CUSTOM-PROPERTIES.md
@@ -1,4 +1,6 @@ # Custom Properties -This installation framework has been parameterized. This means that properties or variables can be passed to modify the -output. These additional properties are set to sensible defaults within the framework but are available for customization. -These properties can be set in the `custom-properties.yml`. \ No newline at end of file +This installation framework has been parameterized. This means that +properties or variables can be passed to modify the output. These +additional properties are set to sensible defaults within the framework +but are available for customization. These properties can be set in the +`custom-properties.yml`.
diff --git a/README-CYGWIN.md b/README-CYGWIN.md index 3576a04..50e9c11 100644 --- a/README-CYGWIN.md +++ b/README-CYGWIN.md
@@ -1,12 +1,14 @@ # Setting Up Ansible with Cygwin -Running Ansible commands from within Windows is unsupported at the time of this writing. -However, windows users can setup Ansible with Cygwin. +Running Ansible commands from within Windows is unsupported at the time +of this writing. However, windows users can setup Ansible with Cygwin. # Installation Steps -Here are steps to getting Ansible (and it's related commands, like ansible-playbook) running on Windows: -Download and install [Cygwin](http://cygwin.com/install.html), with at least the following packages selected -(you can select the packages during the install process): +Here are steps to getting Ansible (and it's related commands, like +ansible-playbook) running on Windows: +Download and install [Cygwin](http://cygwin.com/install.html), with at +least the following packages selected (you can select the packages +during the install process): * curl * python (2.7.x) @@ -28,25 +30,29 @@ * libffi-devel # Working Behind a Proxy -If you are working behind a proxy (as is the case in many corporate networks), edit the .bash_profile used by Cygwin either using vim (open Cygwin and enter vim .bash_profile), or with whatever editor you'd like, and add in lines like the following: +If you are working behind a proxy (as is the case in many corporate +networks), edit the .bash_profile used by Cygwin either using vim (open +Cygwin and enter vim .bash_profile), or with whatever editor you'd like, +and add in lines like the following: export http_proxy=http://username:password@proxy-address-here:80/ export https_proxy=https://username:password@proxy-address-here:80/ # Download and Install PyYAML and Jinja2 Separately -Download and install separately PyYAML and Jinja2 separately, as they're not available via Cygwin's installer: +Download and install separately PyYAML and Jinja2 separately, as they're +not available via Cygwin's installer: ## Open Cygwin -### Download PyYAML +#### Download PyYAML curl -O https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz -### Download Jinja2 +#### Download Jinja2 curl -O https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz -### Untar both downloads +#### Untar both downloads tar -xvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz
diff --git a/README-EC2.md b/README-EC2.md index 1cc865b..65599f5 100644 --- a/README-EC2.md +++ b/README-EC2.md
@@ -1,11 +1,14 @@ # Overview: EC2 Managed Setup -The minimum setup must be completed prior to configuring the EC2 managed setup. The EC2 managed setup will -update perform the following activities: -* Update ~/.bashrc to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY values you provide. +The minimum setup must be completed prior to configuring the EC2 managed +setup. The EC2 managed setup will update perform the following +activities: +* Update ~/.bashrc to export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY +values you provide. * Update ~/.bashrc to export EC2_INI_PATH. * Create a template .boto file and place it your home directory * Create a template ec2.ini and place it in your ~/.ansible folders -* Provide a copy of the ec2.py script that must be included with any AWS managed inventory file. +* Provide a copy of the ec2.py script that must be included with any AWS +managed inventory file. # Usage: Setup for EC2 Managed Images Please follow the usage instructions:
diff --git a/README-credentials.md b/README-credentials.md index 023f94c..3ec38d9 100644 --- a/README-credentials.md +++ b/README-credentials.md
@@ -1,5 +1,5 @@ # Configuring Credentials -Credentials are stored at `~/.apigee/credentials.yml`. A template file is created that includes +Credentials are stored at `~/.apigee-secure/credentials.yml`. A template file is created that includes commented out attributes as placeholders for values that could be needed. ## Credentials Location @@ -12,11 +12,11 @@ Apigee installation. If these are not provided, then the apigee installation scripts will prompt you for them. Given that this is an automated framework that will orchestrate your Apigee installation it is necessary to provide these -attributes ahead of time in the `~/.apigee/credentials.yml` file. +attributes ahead of time in the `~/.apigee-secure/credentials.yml` file. | Required Attribute | Value | Description | |---|---|---| -| apigee_repo_user | APIGEE_REPOSITORY_USERNAME | The verizon user to login to the software.apigee.com | +| apigee_repo_user | APIGEE_REPOSITORY_USERNAME | The customer login to the software.apigee.com | | apigee_repo_password | APIGEE_REPOSITORY_PASSWORD | The login password to software.apigee.com | | opdk_user_name | apigee | The Apigee administrator username and operating system username | | opdk_group_name | apigee | The operating system group name |
diff --git a/README.md b/README.md index 7651012..284478c 100644 --- a/README.md +++ b/README.md
@@ -1,5 +1,6 @@ # Apigee OPDK Ansible Setup Playbook -The purpose of this project is to help configure Ansible for the use of [Apigee OPDK roles](https://github.com/carlosfrias/apigee-opdk-playbook-samples). +The purpose of this project is to help configure Ansible for the use of +[Apigee OPDK roles](https://github.com/carlosfrias/apigee-opdk-playbook-samples). The Apigee OPDK roles follow conventions in the naming of files and where those files are located. This project sets up those locations and performs the git clone to setup your environment with the templates that should be customized for your use. @@ -7,31 +8,19 @@ # Quick Installation Assuming ansible is already installed then you can setup with the following steps: -* `mkdir ~/apigee-workspace` -* `cd ~/apigee-workspace` -* `git clone https://onestash.verizon.com/projects/CELVW/repos/apigee-opdk-playbook-setup-ansible/browse` -* `cd apigee-opdk-playbook-setup-ansible` -* Make sure your public ssh key has been added to stash. -* `ansible-playbook setup.yml` -* Update the credentials.yml file as indicated below. -* Add the license.txt file to `~/.apigee/license.txt` -* Configure ansible to work with the correct configuration using: - - `export ANSIBLE_CONFIG=~/.ansible/configurations/vz-edge-1701-aio.cfg - cd ~/apigee-workspace/apigee-opdk-playbook-installation-single-region - ansible-galaxy install -r install-edge-aio-requirements.yml` - -* The first invocation should be: - - `ansible-playbook install-edge-aio.yml -e @~/.apigee/credentials.yml -e @~/.apigee/custom-properties.yml --become --become-method=pbrun --skip-tags=root,selinux,apigee-user,iptables,ipv6 -k -vvv` - -* Subsequent invocations can save time by skipping tags that were invoked previously, you can skip re-creating the cache like this: - - `ansible-playbook install-edge-aio.yml -e @~/.apigee/credentials.yml -e @~/.apigee/custom-properties.yml --become --become-method=pbrun --skip-tags=root,selinux,apigee-user,iptables,ipv6,cache -k -vvv` - - OR skip re-installing os pre-requisites or apigee pre-requisites like this - - `ansible-playbook install-edge-aio.yml -e @~/.apigee/credentials.yml -e @~/.apigee/custom-properties.yml --become --become-method=pbrun --skip-tags=root,selinux,apigee-user,iptables,ipv6,cache,os-pre-req,apigee-pre-req -k -vvv` +1. `mkdir ~/apigee-workspace` +1. `cd ~/apigee-workspace` +1. Make sure your public ssh key has been added to stash. +1. `git clone git@github.com:carlosfrias/apigee-opdk-playbook-setup-ansible.git` +1. `cd apigee-opdk-playbook-setup-ansible` +1. `ansible-playbook setup.yml` +1. Update the credentials.yml file as indicated below. +1. Add the license.txt file to `~/.apigee-secure/license.txt` +1. Configure ansible to work with the correct configuration using: + `export ANSIBLE_CONFIG=~/.ansible/configurations/edge-1701-dc1.cfg` +1. `cd ~/apigee-workspace/apigee-opdk-playbook-workspace/apigee-opdk-playbook-installation-single-region` +1. `ansible-galaxy install -r install-edge-requirements.yml` +1. The first invocation should be: `ansible-playbook install-edge.yml --become --become-method=pbrun --tags=cache,ds,ms,rmp,qs,org` # Installing Ansible on Windows Please see the provided [Cygwin readme](README-CYGWIN.md) for instructions on installing Ansible on Windows.
diff --git a/backup.yml b/backup.yml new file mode 100644 index 0000000..53ddc03 --- /dev/null +++ b/backup.yml
@@ -0,0 +1,20 @@ +--- +- name: Backup custom-properties, credentials and license files + hosts: "{{ target_hosts }}" + vars_files: + - repository-custom-properties.yml + tasks: + - name: Create backup folder + file: + path: backups + state: directory + + - name: Backup files + fetch: + src: "{{ item.dir }}/{{ item.name }}" + dest: "backups/{{ item.name }}" + flat: yes + with_items: + - { dir: "{{ apigee_config }}", name: license.txt } + - { dir: "{{ apigee_config }}/apigee-opdk-custom-properties", name: custom-properties.yml } + - { dir: "{{ apigee_security }}", name: credentials.yml }
diff --git a/control_server_bashrc.sh b/control_server_bashrc.sh new file mode 100644 index 0000000..2d46677 --- /dev/null +++ b/control_server_bashrc.sh
@@ -0,0 +1,16 @@ +# .bashrc + +# Source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + +# Uncomment the following line if you don't like systemctl's auto-paging feature: +# export SYSTEMD_PAGER= + +# User specific aliases and functions +HTTP_PROXY_HOST="{{ host:port }}" +HTTPS_PROXY_HOST="{{ host:port }}" +alias proxify="export http_proxy=$HTTP_PROXY_HOST; export https_proxy=$HTTPS_PROXY_HOST" +alias unproxify="unset http_proxy https_proxy" +
diff --git a/repository-custom-properties.yml b/repository-custom-properties.yml index 5c1d831..49d9f7c 100644 --- a/repository-custom-properties.yml +++ b/repository-custom-properties.yml
@@ -1,15 +1,17 @@ --- -ansible_config: ~/.ansible -apigee_config: ~/.apigee -apigee_workspace: ~/apigee-workspace +ansible_config: "~/.ansible" +apigee_config: "~/.apigee" +apigee_security: "~/.apigee-secure" +apigee_workspace: "~/apigee-workspace" playbook_workspace: "{{ apigee_workspace }}/apigee-opdk-playbook-workspace" role_workspace: "{{ apigee_workspace }}/apigee-opdk-role-workspace" -repository_secure_endpoint_https: "https://onestash.verizon.com/rest/api/1.0/projects/CELVW" -repository_secure_endpoint_ssh: "ssh://git@onestash.verizon.com:7999/celvw" +repository_secure_endpoint_https: "https://github.com/carlosfrias" +repository_secure_endpoint_ssh: "git@github.com:carlosfrias" configuration_folders: - '{{ ansible_config }}/configurations' - '{{ ansible_config }}/inventory' - '{{ ansible_config }}/tmp/logs' -- '{{ apigee_config }}' +- '{{ apigee_config }}/logs_configs' +- '{{ apigee_security }}' - '{{ playbook_workspace }}' - '{{ role_workspace }}'
diff --git a/repository-mapping-name-folder.yml b/repository-mapping-name-folder.yml old mode 100644 new mode 100755 index 3e88f38..62dee8f --- a/repository-mapping-name-folder.yml +++ b/repository-mapping-name-folder.yml
@@ -1,27 +1,34 @@ --- -repo_names: -- { workspace: '{{ playbook_dir }}/..', repo_name: local-workspace-maintenance } -- { workspace: '{{ playbook_dir }}/..', repo_name: apigee-opdk-playbook-setup-ansible } -#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-aio } moved into apigee-opdk-playbook-installation-single-region -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-baas } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-microgateway } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-mirror } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-monetization } +config_repos: +- { workspace: '{{ apigee_workspace }}', repo_name: apigee-opdk-playbook-setup-ansible } +#- { workspace: '{{ apigee_config }}', repo_name: apigee-opdk-custom-properties } +- { workspace: '{{ apigee_workspace }}', repo_name: local-workspace-maintenance } +- { workspace: '{{ ansible_config }}', repo_name: apigee-opdk-ansible-configuration-samples } +- { workspace: '{{ ansible_config }}', repo_name: apigee-opdk-ansible-inventory-samples } + +playbook_repos: - { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-single-region } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-third-region } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-two-regions } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-aws-management } - { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-backup } - { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-cassandra-validation } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-expand-region } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-opdk-upgrade } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-postgres-add-remove } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-qpid-add-remove } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-update-message-processor-properties } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-vagrant } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-validate-port-availability } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-samples } -- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-cassandra-replication-factor } +##- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-aio } # moved into apigee-opdk-playbook-installation-single-region +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-baas } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-microgateway } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-mirror } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-monetization } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-third-region } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-installation-two-regions } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-aws-management } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-expand-region } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-opdk-upgrade } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-postgres-add-remove } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-qpid-add-remove } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-update-message-processor-properties } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-vagrant } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-validate-port-availability } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-samples } +#- { workspace: '{{ playbook_workspace }}', repo_name: apigee-opdk-playbook-maintenance-cassandra-replication-factor } + +role_repos: - { workspace: '{{ role_workspace }}', repo_name: apigee-fetch-files } - { workspace: '{{ role_workspace }}', repo_name: apigee-internal-port-connectivity-validator-cassandra } - { workspace: '{{ role_workspace }}', repo_name: apigee-internal-port-connectivity-validator-ldap } @@ -50,6 +57,7 @@ - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-set-reachable } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-analytics-group-add } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-apigee-user } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-apigee-user-ownership } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-bootstrap } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-bootstrap-archive-installer } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-bootstrap-create-archive } @@ -59,6 +67,8 @@ - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-component } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-component-installer } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-default-settings } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-os-epel } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-license } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-message-processor-bind-environment } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-openjdk } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-org } @@ -102,5 +112,11 @@ - { workspace: '{{ role_workspace }}', repo_name: apigee-server-restart } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-cwc-update } - { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-postgres-db-upgrade } -- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-cyberark-host-registration } - +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-yum-repository-enabled } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-yum-repository-proxy-config } +- { workspace: '{{ role_workspace }}', repo_name: apigee-lvm-increase-volume-size } +- { workspace: '{{ role_workspace }}', repo_name: apigee-lvm-create-physical-volume } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-yum-packages } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-mirror-nginx } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-setup-component-install } +- { workspace: '{{ role_workspace }}', repo_name: apigee-opdk-debug-mode }
diff --git a/setup-base.yml b/setup-base.yml index a6b03d4..43ac4fc 100644 --- a/setup-base.yml +++ b/setup-base.yml
@@ -6,68 +6,81 @@ - repository-custom-properties.yml tasks: - - name: Create ansible configuration folders + - name: Ensure ansible configuration folders exist file: path: '{{ item }}' state: directory with_items: '{{ configuration_folders }}' + tags: ['config'] - block: - - name: Git ssh checkout of sample configurations - become: false - ignore_errors: yes - git: - repo: '{{ repository_secure_endpoint_ssh }}/apigee-opdk-ansible-configuration-samples.git' - dest: "{{ ansible_config }}/configurations" - accept_hostkey: yes - - - name: Git checkout of sample inventories - become: false - ignore_errors: yes - git: - repo: '{{ repository_secure_endpoint_ssh }}/apigee-opdk-ansible-inventory-samples.git' - dest: "{{ ansible_config }}/inventory" - accept_hostkey: yes - - - name: Git checkout of sample playbooks + - name: Git checkout of configuration repositories + tags: ['config'] become: false ignore_errors: yes git: repo: '{{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git' dest: "{{ item.workspace }}/{{ item.repo_name }}" accept_hostkey: yes - with_items: "{{ repo_names }}" + with_items: "{{ config_repos }}" + + - name: Git checkout of playbook repositories + tags: ['playbooks'] + become: false + git: + repo: '{{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git' + dest: "{{ item.workspace }}/{{ item.repo_name }}" + accept_hostkey: yes + with_items: "{{ playbook_repos }}" + + - name: Git checkout of role repositories + tags: ['roles'] + become: false + git: + repo: '{{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git' + dest: "{{ item.workspace }}/{{ item.repo_name }}" + accept_hostkey: yes + update: yes + version: master + with_items: "{{ role_repos }}" + when: role_repos is defined when: checkout_type | trim == 'ssh' | default('ssh') - block: - - name: Git checkout of sample configurations + - name: Git checkout of configuration repositories + tags: ['config'] become: false ignore_errors: yes git: - repo: '{{ repository_secure_endpoint_https }}/apigee-opdk-ansible-configuration-samples.git' - dest: "{{ ansible_config }}/configurations" - accept_hostkey: yes - - - name: Git checkout of sample inventories - become: false - ignore_errors: yes - git: - repo: '{{ repository_secure_endpoint_ssh }}/apigee-opdk-ansible-inventory-samples.git' - dest: "{{ ansible_config }}/inventory" - accept_hostkey: yes - - - name: Git checkout of sample playbooks - become: false - ignore_errors: yes - git: - repo: '{{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git' + repo: '{{ repository_secure_endpoint_https }}/{{ item.repo_name }}.git' dest: "{{ item.workspace }}/{{ item.repo_name }}" accept_hostkey: yes - with_items: "{{ repo_names }}" + with_items: "{{ config_repos }}" + + - name: Git checkout of playbook repositories + tags: ['playbooks'] + become: false + git: + repo: '{{ repository_secure_endpoint_https }}/{{ item.repo_name }}.git' + dest: "{{ item.workspace }}/{{ item.repo_name }}" + accept_hostkey: yes + with_items: "{{ playbook_repos }}" + + - name: Git checkout of role repositories + tags: ['roles'] + become: false + git: + repo: '{{ repository_secure_endpoint_https }}/{{ item.repo_name }}.git' + dest: "{{ item.workspace }}/{{ item.repo_name }}" + accept_hostkey: yes + update: yes + version: master + with_items: "{{ role_repos }}" + when: role_repos is defined when: checkout_type | trim == 'https' - name: Add empty credentials.yml file to .apigee copy: src: resources/credentials.yml - dest: '{{ apigee_config }}/credentials.yml' + dest: '{{ apigee_security }}/credentials.yml' force: no
diff --git a/setup.yml b/setup.yml index 887496a..867efb8 100644 --- a/setup.yml +++ b/setup.yml
@@ -1,7 +1,6 @@ --- # - include: setup-ansible-config.yml - #- include: control-server.yml - include: setup-base.yml
diff --git a/update-git-remote-origin.yml b/update-git-remote-origin.yml new file mode 100644 index 0000000..b13e2b2 --- /dev/null +++ b/update-git-remote-origin.yml
@@ -0,0 +1,47 @@ +--- +- name: Update git remote repos with provided url + hosts: localhost + connection: local + gather_facts: no + + vars_files: + - repository-mapping-name-folder.yml + - repository-custom-properties.yml + + tasks: + + - name: Remove existing origin repo for playbooks + tags: ['remove'] + shell: "git remote remove origin" + args: + chdir: "{{ item.workspace }}/{{ item.repo_name }}" + with_items: + - "{{ playbook_repos }}" + - "{{ role_repos }}" + + - name: Add updated origin repo + tags: ['add'] + shell: "git remote add origin {{ repository_secure_endpoint_ssh }}/{{ item.repo_name }}.git" + args: + chdir: "{{ item.workspace }}/{{ item.repo_name }}" + with_items: + - "{{ playbook_repos }}" + - "{{ role_repos }}" + + - name: Associate to upstream master branch + tags: ['associate'] + shell: "git branch --set-upstream-to=origin/master master" + args: + chdir: "{{ item.workspace }}/{{ item.repo_name }}" + with_items: + - "{{ playbook_repos }}" + - "{{ role_repos }}" + + - name: Pull from updated origin repo + tags: ['pull'] + shell: "git pull" + args: + chdir: "{{ item.workspace }}/{{ item.repo_name }}" + with_items: + - "{{ playbook_repos }}" + - "{{ role_repos }}"