diff --git a/README.md b/README.md index b3e59430..fe0dfdbc 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,10 @@ - [Example 2: Setup on a local machine :: Setup Minishift + OS templates + Jenkins 2.0 pipelines](#example-2-setup-on-a-local-machine--setup-minishift--os-templates--jenkins-20-pipelines) - [Example 3: Setup on a local machine :: Setup Minishift + OS templates + Jenkins 2.0 pipelines](#example-3-setup-on-a-local-machine--setup-minishift--os-templates--jenkins-20-pipelines) - [Example 4: Setup on a local machine :: Start Minishift w/profile mysetup + OS templates + Jenkins 2.0 pipelines](#example-4-setup-on-a-local-machine--start-minishift-wprofile-mysetup--os-templates--jenkins-20-pipelines) + - [Example 1: Setup on a local machine :: Setup Minishift + OS templates](#example-1-setup-on-a-local-machine--setup-minishift--os-templates) + - [Example 2: Setup on a local machine :: Setup Minishift + OS templates + Jenkins 2.0 pipelines](#example-2-setup-on-a-local-machine--setup-minishift--os-templates--jenkins-20-pipelines) + - [Example 3: Setup on a local machine :: Setup Minishift + OS templates + Jenkins 2.0 pipelines](#example-3-setup-on-a-local-machine--setup-minishift--os-templates--jenkins-20-pipelines) + - [Example 4: Using the playbook hooks on contra-env-setup](#example-4-using-the-playbook-hooks-on-contra-env-setup) - [Debugging Issues](#debugging-issues) - [Issue #1: Can't push images to the Minishift cluster](#issue-1-cant-push-images-to-the-minishift-cluster) - [Solution #1:](#solution-1) @@ -85,7 +89,6 @@ contra-env-setup/playbooks/group_vars/all/global.yml * memory: Memory size to use for the VM : default=6400mb * cpus: Number of cpus to use for minishift VM: default=2 * minishift_iso: ISO image to use : default=http://artifacts.ci.centos.org/fedora-atomic/minishift/iso/minishift.iso -* start_minishift: start an existing minishift instance: default=false ### oc setup options * openshift_project: OpenShift project name : default:contra-sample-project @@ -210,6 +213,20 @@ _Note: The -K is used to prompt you for your password for sudo (if you require o The -k is used to prompt you for your ssh password can hit enter if using -K and they are the same
Instead of -k you could use --private-key=_ +### Example 4: Using the playbook hooks on contra-env-setup + +This resource permit to create your playbooks to included as the last role that will be +executed on contra-env-setup. + +``` + ansible-playbook -vv -i "localhost," contra-env-setup/playbooks/setup.yml \ + -e user=cloud-user -e project_repo=https://github.com/arilivigni/ci-pipeline \ + -e openshift_project=ari-ci-pipeline -e tag=develop -e setup_pipelines=true \ + -e setup_sample_project -K -k + --extra-vars='{"hooks": ["/contra-env-setup/playbook_a.yml","/contra-env-setup/playbook_b.yml"]}' + +``` + ## Debugging Issues ### Issue #1: Can't push images to the Minishift cluster diff --git a/playbooks/group_vars/all/global.yml b/playbooks/group_vars/all/global.yml index d4148ef8..44ebcfe4 100644 --- a/playbooks/group_vars/all/global.yml +++ b/playbooks/group_vars/all/global.yml @@ -7,6 +7,7 @@ startup_minishift: false setup_containers: true setup_pipelines: false setup_sample_project: false +setup_playbook_hooks: false force_minishift_install: false force_repo_clone: true diff --git a/playbooks/roles/os_temps/tasks/setup_os_templates.yml b/playbooks/roles/os_temps/tasks/setup_os_templates.yml index c324407c..b085499d 100644 --- a/playbooks/roles/os_temps/tasks/setup_os_templates.yml +++ b/playbooks/roles/os_temps/tasks/setup_os_templates.yml @@ -151,5 +151,5 @@ # Setup tag if container image build successful - name: Modify tags on images - shell: "{{ oc_bin }} get is | awk '{print $2}' | grep -v DOCKER | sed 's/.*5000\\///g' | grep '{{ build_config_name_file.stdout }}' | xargs -i {{ oc_bin }} tag {}:latest {}:{{ tag }}" - when: modify_tags|bool == true and build_success|bool == true \ No newline at end of file + shell: "{{ oc_bin }} get imagestream | awk '{print $2}' | grep -v DOCKER | sed 's/.*5000\\///g' | grep '{{ build_config_name_file.stdout }}' | xargs -i {{ oc_bin }} tag {}:latest {}:{{ tag }}" + when: modify_tags|bool == true and build_success|bool == true diff --git a/playbooks/setup.yml b/playbooks/setup.yml index ce725cae..6356b69e 100644 --- a/playbooks/setup.yml +++ b/playbooks/setup.yml @@ -10,4 +10,5 @@ - { role: prereqs, when: "run_prereqs|bool == true and setup_minishift|bool == true" } - { role: minishift, when: "setup_minishift|bool == true and start_minishift == false" } - { role: os_temps, when: setup_containers|bool == true } - - { role: pipeline, when: setup_pipelines|bool == true } \ No newline at end of file + - { role: pipeline, when: setup_pipelines|bool == true } + - { role: playbook_hooks, when: setup_playbook_hooks|bool == true }