<commit_before>#============================  Build Master-jenkins playbook  ============================#

#===============================  Notes  ===============================#
#  - Base Ansible playbook to run on a fresh RHEL7 install              #
#                                                                       #
#=======================================================================#

---
- hosts: "{{ HOST }}"

  become_method: sudo

  user: ec2-user

  tasks:

    - name: Upgrade all packages
      become: true
      yum: name=* state=latest

    - name: Install EPEL and IUS repos
      become: true
      yum: name={{ item }}
      with_items:
        - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
        - https://centos7.iuscommunity.org/ius-release.rpm

    - name: Setup jenkins repo
      become: true
      get_url: 
        url: "https://pkg.jenkins.io/redhat-stable/jenkins.repo"
        dest: "/etc/yum.repos.d/jenkins.repo"

    - name: Setup Docker repo
      become: true
      get_url:
        url: "https://download.docker.com/linux/centos/docker-ce.repo"
        dest: "/etc/yum.repos.d/docker-ce.repo"

    - name: Install dependencies for docker
      become: true
      yum: name={{ item }}
      with_items:
        - http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
        - http://mirror.centos.org/centos/7/extras/x86_64/Packages/pigz-2.3.3-1.el7.centos.x86_64.rpm

    - name: Import jenkins key 
      become: true
      rpm_key:
        state: present
        key: "https://pkg.jenkins.io/redhat-stable/jenkins.io.key"

    - name: Install base dependencies
      become: true
      yum: name={{ item }}
      with_items:
        - ansible
        - gcc
        - gcc-c++
        - git
        - java-1.8.0-openjdk
        - java-1.8.0-openjdk-devel.x86_64
        - pcre.x86_64
        - pcre-devel.x86_64
        - postgresql-devel.x86_64
        - python-devel.x86_64
        - python-pip
        - python35u
        - python35u-devel 
        - python35u-libs
        - python35u-pip
        - unzip
        - wget
        - zlib-devel
        - mlocate
        - vim
        - telnet
        - jenkins
        - yum-utils
        - docker-ce

    - name: Install all pip packages
      become: true
      pip: 
        name: "{{ item }}"
        state: present
        executable: pip
      with_items:
        - awscli
        - boto

    - name: Install pip3.5 packages
      become: true
      pip: 
        name: "{{ item }}"
        state: present
        executable: pip3.5
      with_items:
        - boto3
        - sh
        - python-packer
        - wheel
        - virtualenv-clone
        
    - name: Create /opt/terraform directory
      become: true
      file: 
        path: /opt/terraform
        state: directory
        mode: 0755

    - name: Download and unarchive terraform_0.11.7_linux_amd64.zip
      become: true
      unarchive:
        src: https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip
        dest: /opt/terraform
        remote_src: yes

    - name: Create /opt/packer directory
      become: true
      file: 
        path: /opt/packer
        state: directory
        mode: 0755

    - name: Download and unarchive packer_1.2.4_linux_amd64.zip
      become: true
      unarchive:
        src: https://releases.hashicorp.com/packer/1.2.4/packer_1.2.4_linux_amd64.zip
        dest: /opt/packer
        remote_src: yes

    - name: Rename packer to packerio
      become: true
      shell: "mv /opt/packer/packer /opt/packer/packerio"

    - name: Setup symbolic link
      become: true
      file: 
        src: /opt/packer/packerio
        dest: /usr/sbin/packerio
        owner: root
        group: root
        state: link

    - name: Load symlink variable
      become: true
      stat: 
        path: /usr/sbin/packerio
      register: pack

    - name: Check symbolic link exists
      debug: 
        msg="Path exists and is a symlink"
      when: pack.stat.islnk is defined and pack.stat.islnk

    - name: Show timestamp in history (root)
      become: true
      lineinfile: 
        dest: /root/.bash_profile
        line: "export HISTTIMEFORMAT=\"%d/%m/%y %T \""
        state: present

    - name: Show timestamp in history (ec2-user)
      lineinfile: 
        dest: /home/ec2-user/.bash_profile
        line: "export HISTTIMEFORMAT=\"%d/%m/%y %T \""
        state: present

    - name: Colorize (root)
      become: true
      lineinfile: 
        dest: /root/.bash_profile
        line: 'export PS1="[\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;45m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\] \W]\\$ \[$(tput sgr0)\]"'
        state: present

    - name: Colorize (ec2-user)
      lineinfile:
        dest: /home/ec2-user/.bash_profile
        line: 'export PS1="[\[$(tput sgr0)\]\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;45m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\] \W]\\$ \[$(tput sgr0)\]"'
        state: present

    - name: Restart and enable jenkins service
      become: true
      shell: "systemctl enable jenkins && systemctl restart jenkins"

#====================================  EOF  ====================================# 
<commit_msg>fix syntax issues<commit_after>#============================  Build Master-jenkins playbook  ============================#

#===============================  Notes  ================================#
#  - Base Ansible playbook to run on a fresh RHEL7 install               #
#  - Installs Jenkins dependencies that are mutal across environments    #
#  - This playbook is for Build-Jenkins                                  #
#  -                                                                     #
#========================================================================#

---
- hosts: "{{ HOST }}"

  user: ec2-user
  become_method: sudo

  tasks:

    - name: upgrade all yum packages, kernel updates, OS patches
      become: true
      yum:
        name: '*'
        state: latest

    - name: install EPEL and IUS repos
      become: true
      yum:
        name: "{{ item }}"
      with_items:
        - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
        - https://centos7.iuscommunity.org/ius-release.rpm

    - name: Setup jenkins repo
      become: true
      get_url: 
        url: "https://pkg.jenkins.io/redhat-stable/jenkins.repo"
        dest: "/etc/yum.repos.d/jenkins.repo"

    - name: Setup Docker repo
      become: true
      get_url:
        url: "https://download.docker.com/linux/centos/docker-ce.repo"
        dest: "/etc/yum.repos.d/docker-ce.repo"

    - name: Install dependencies for docker
      become: true
      yum: 
        name: "{{ item }}"
      with_items:
        - http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.42-1.gitad8f0f7.el7.noarch.rpm
        - http://mirror.centos.org/centos/7/extras/x86_64/Packages/pigz-2.3.3-1.el7.centos.x86_64.rpm

    - name: Import jenkins key 
      become: true
      rpm_key:
        state: present
        key: "https://pkg.jenkins.io/redhat-stable/jenkins.io.key"

    - name: Install base dependencies
      become: true
      yum: 
        name: "{{ item }}"
      with_items:
        - gcc
        - gcc-c++
        - git
        - java-1.8.0-openjdk
        - java-1.8.0-openjdk-devel.x86_64
        - pcre.x86_64
        - pcre-devel.x86_64
        - postgresql-devel.x86_64
        - python-devel.x86_64
        - python-pip
        - python35u
        - python35u-devel 
        - python35u-libs
        - python35u-pip
        - unzip
        - wget
        - zlib-devel
        - mlocate
        - vim
        - telnet
        - jenkins
        - yum-utils
        - docker-ce

    - name: Install all pip packages
      become: true
      pip: 
        name: "{{ item }}"
        executable: pip
      with_items:
        - awscli
        - boto

    - name: Install pip3.5 packages
      become: true
      pip: 
        name: "{{ item }}"
        executable: pip3.5
      with_items:
        - boto3
        - sh
        - python-packer
        - wheel
        - virtualenv-clone

    - name: install ansible-2.4.2.0 package via pip3.5
      become: true
      pip: 
        name: ansible
        version: 2.4.2.0
        executable: pip3.5
        
    - name: Create /opt/terraform directory
      become: true
      file: 
        path: /opt/terraform
        state: directory
        mode: 0755

    - name: Download and unarchive terraform_0.11.7_linux_amd64.zip
      become: true
      unarchive:
        src: https://releases.hashicorp.com/terraform/0.11.7/terraform_0.11.7_linux_amd64.zip
        dest: /opt/terraform
        remote_src: yes

    - name: Create /opt/packer directory
      become: true
      file: 
        path: /opt/packer
        state: directory
        mode: 0755

    - name: Download and unarchive packer_1.2.4_linux_amd64.zip
      become: true
      unarchive:
        src: https://releases.hashicorp.com/packer/1.2.4/packer_1.2.4_linux_amd64.zip
        dest: /opt/packer
        remote_src: yes

    - name: Rename packer to packerio
      become: true
      shell: "mv /opt/packer/packer /opt/packer/packerio"

    - name: Setup symbolic link
      become: true
      file: 
        src: /opt/packer/packerio
        dest: /usr/sbin/packerio
        owner: root
        group: root
        state: link

    - name: Load symlink variable
      become: true
      stat: 
        path: /usr/sbin/packerio
      register: pack

    - name: Check symbolic link exists
      debug: 
        msg="Path exists and is a symlink"
      when: pack.stat.islnk is defined and pack.stat.islnk

    - name: Show timestamp in history (root)
      become: true
      lineinfile: 
        dest: /root/.bash_profile
        line: "export HISTTIMEFORMAT=\"%d/%m/%y %T \""

    - name: Show timestamp in history (ec2-user)
      lineinfile: 
        dest: /home/ec2-user/.bash_profile
        line: "export HISTTIMEFORMAT=\"%d/%m/%y %T \""

    - name: Colorize (root)
      become: true
      lineinfile: 
        dest: /root/.bash_profile
        line: 'export PS1="[\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;45m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\] \W]\\$ \[$(tput sgr0)\]"'

    - name: Colorize (ec2-user)
      lineinfile:
        dest: /home/ec2-user/.bash_profile
        line: 'export PS1="[\[$(tput sgr0)\]\[\033[38;5;11m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;45m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\] \W]\\$ \[$(tput sgr0)\]"'

    - name: Enable and Restart Jenkins service
      become: true
      shell: "systemctl enable jenkins && systemctl restart jenkins"

#====================================  EOF  ====================================#

{'fraction_non_alphanumeric': 0.17052919708029196, 'fraction_numerical': 0.035036496350364967, 'mean_word_length': 1.7819796954314722, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1952492', 'n_tokens_mistral': 3957, 'n_tokens_neox': 3671, 'n_words': 739}