{"id":22941322,"url":"https://github.com/thejaxon/ansible_labs","last_synced_at":"2025-08-04T18:06:20.925Z","repository":{"id":130963031,"uuid":"251037711","full_name":"theJaxon/ansible_labs","owner":"theJaxon","description":"Part of the continuous delivery module.","archived":false,"fork":false,"pushed_at":"2020-03-29T16:51:29.000Z","size":215,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T15:09:33.222Z","etag":null,"topics":["ansible","ansible-playbook"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theJaxon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-29T13:24:17.000Z","updated_at":"2020-03-29T16:51:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"3dea921f-e79e-4b2e-a085-90e29ed0a4a8","html_url":"https://github.com/theJaxon/ansible_labs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theJaxon/ansible_labs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theJaxon%2Fansible_labs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theJaxon%2Fansible_labs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theJaxon%2Fansible_labs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theJaxon%2Fansible_labs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theJaxon","download_url":"https://codeload.github.com/theJaxon/ansible_labs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theJaxon%2Fansible_labs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268738991,"owners_count":24299558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-playbook"],"created_at":"2024-12-14T13:38:44.771Z","updated_at":"2025-08-04T18:06:20.859Z","avatar_url":"https://github.com/theJaxon.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# ansible_labs\nPart of the continuous delivery module.\n\n[![forthebadge](https://forthebadge.com/images/badges/60-percent-of-the-time-works-every-time.svg)](https://forthebadge.com)\n\n### Lab 1:\n#### Screens:\n\u003cdetails\u003e\n\u003csummary\u003eEC2 after installing Apache web server\u003c/summary\u003e\n\u003cp\u003e\n  \u003cimg src=\"https://github.com/theJaxon/ansible_labs/blob/master/Lab%201/1.jpg\"\u003e\n  \u003cimg src=\"https://github.com/theJaxon/ansible_labs/blob/master/Lab%201/2.jpg\"\u003e\n\u003c/p\u003e\n\u003c/details\u003e  \n\n#### Steps:\n1. EC2 instance launched allowing HTTP traffic on port 80\n2. SSH connections were allowed on port 22\n3. `~/.ssh/id_rsa.pub` was copied to the instance `~/.ssh/authorized_keys`\n4. `ansible-playbook firstplaybook.yaml`\n\n```yaml\n---\n- hosts: EC\n  remote_user: ec2-user\n  become: true\n  tasks:\n  - name: install apache\n    package:\n      name: httpd\n      state: present\n  - name: start apache web server\n    service:\n      name: httpd\n      state: started\n  - name: write to the web page\n    copy:\n      src: index.html\n      dest: /var/www/html/\n```\n\n___\n\n\n### Lab 2:\n#### Screens:\n\u003cdetails\u003e\n\u003csummary\u003ego-cd server running and nexus failing to start\u003c/summary\u003e\n\u003cp\u003e\n  \u003cimg src=\"https://github.com/theJaxon/ansible_labs/blob/master/Lab%202/Previews/go-server.jpg\"\u003e\n  \u003cimg src=\"https://github.com/theJaxon/ansible_labs/blob/master/Lab%202/Previews/Nexus.jpg\"\u003e\n\u003c/p\u003e\n\u003c/details\u003e  \n\n#### Steps:\n1. Two roles were added with the following commands:\n   * $ `ansible-galaxy init gocd`\n   * $ `ansible-galaxy init nexus`\n\n2- The following yaml file located at `gocd/tasks/main.yml` was used:\n```yaml\n---\n# tasks file for gocd\n- name: Download the .repo file for gocd and save it to /etc/yum/repos.d/\n  get_url: \n    url: https://download.gocd.org/gocd.repo\n    dest: /etc/yum.repos.d/gocd.repo\n\n- name: Install gocd server \n  package:\n    name: go-server\n    state: present\n\n- name: start gocd server \n  service:\n    name: go-server \n    state: started\n\n- name: install gocd agent\n  package:\n    name: go-agent \n    state: present \n\n- name: start gocd agent \n  service: \n    name: go-agent\n    state: started \n```\n\n3- The file located at `nexus/tasks/main.yml` was used for the second task:\n```yaml\n---\n# tasks file for nexus\n- name: install OpenJDK 1.8 \n  package:\n    name: java-1.8.0-openjdk.x86_64\n    state: present\n\n- name: creating app directory\n  file:\n    path: /app\n    state: directory \n\n- name: download the latest nexus \n  get_url:\n    url: https://download.sonatype.com/nexus/3/latest-unix.tar.gz\n    dest: /app/\n\n- name: extract downloaded archive to the current directory \n  unarchive: \n    src: /app/nexus-3.22.0-02-unix.tar.gz\n    dest: /app/\n    remote_src: yes\n\n- name: remove the downloaded archive file \n  shell: \u003e\n    rm -rf /app/*.gz\n\n- name: rename the extracted file to 'nexus'\n  shell: \u003e\n    mv /app/nexus-3* /app/nexus\n\n- name: add nexus user \n  user: \n    name: nexus \n    comment: Nexus user \n\n- name: change ownership of /app/nexus and /app/sonatype-network to the nexus user \n  file:\n    path: \"{{ item }}\"\n    owner: nexus \n  loop:\n    - /app/nexus \n    - /app/sonatype-work \n\n- name: copy nexus.service file to /etc/systemd/system/\n  copy:\n    src: nexus.service \n    dest: /etc/systemd/system/\n\n- name: start the nexus service \n  service: \n    name: nexus \n    state: started \n\n- name: allow nexus on boot\n  systemd:\n    name: nexus \n    enabled: yes\n```\n\n4- `main.yml` was used to execute the scripts:\n```yaml\n---\n- hosts: all\n  remote_user: ec2-user \n  become: true\n  roles:\n    - gocd\n    - nexus\n```\n\nThe command used: \n$ `ansible-playbook -i inventory main.yaml`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthejaxon%2Fansible_labs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthejaxon%2Fansible_labs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthejaxon%2Fansible_labs/lists"}