Last active
May 12, 2022 23:36
-
-
Save lachaib/b8b6b630a7e68ff311b44b333da98941 to your computer and use it in GitHub Desktop.
Development Environment with Ansible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Install docker | |
hosts: all | |
become: true | |
tags: docker | |
vars: | |
ansible_python_interpreter: python3 | |
tasks: | |
- name: Install APT requirements | |
apt: | |
name: | |
- apt-transport-https | |
- ca-certificates | |
- curl | |
- gnupg | |
- lsb-release | |
state: present | |
- name: Add docker's GPG key | |
apt_key: | |
url: https://download.docker.com/linux/ubuntu/gpg | |
state: present | |
- name: Add docker's stable repo | |
apt_repository: | |
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable | |
state: present | |
update_cache: true | |
- name: Install docker | |
apt: | |
name: | |
- docker-ce | |
- docker-ce-cli | |
- containerd.io | |
- docker-compose | |
- name: Add user vagrant to docker group | |
user: | |
name: vagrant | |
groups: docker | |
append: true | |
- name: Clone the repo | |
hosts: all | |
tags: project,github | |
vars: | |
ansible_python_interpreter: python3 | |
tasks: | |
- name: Ensure github.com is a known host | |
lineinfile: | |
dest: ~/.ssh/known_hosts | |
create: true | |
state: present | |
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}" | |
regexp: "^github\\.com" | |
- stat: path=partoo | |
register: clone | |
- name: Clone the partoo repo | |
git: | |
repo: [email protected]:PartooHub/partoo.git | |
clone: true | |
dest: partoo | |
when: not clone.stat.exists | |
- name: Install the project | |
hosts: all | |
tags: project,install | |
vars: | |
ansible_python_interpreter: python3 | |
tasks: | |
- name: Install dependencies | |
become: true | |
apt: | |
name: ['python3-pip', 'libxml2-dev', 'libxmlsec1-dev', 'libxmlsec1-openssl', 'python-dev', 'build-essential', 'libssl-dev', 'libffi-dev', 'zlib1g-dev', 'pkg-config', 'postgresql-client'] | |
state: present | |
- name: Increase filewatcher capability | |
become: true | |
ansible.posix.sysctl: | |
name: fs.inotify.max_user_watches | |
value: '131072' | |
reload: yes | |
state: present | |
- name: Configure the host | |
hosts: localhost | |
tags: localhost | |
tasks: | |
- name: Add dev domains to /etc/hosts | |
become: true | |
lineinfile: | |
path: /etc/hosts | |
regexp: 'dev\.partoo\.co' | |
line: "{{ hostvars['partoo.dev'].ansible_host }} dev.partoo.co api.dev.partoo.co app.dev.partoo.co static.dev.partoo.co" | |
state: present | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment