Skip to content

creativecommons/ansible-dev

Repository files navigation

ansible-dev

Ansible dev environment

Code of Conduct

CODE_OF_CONDUCT.md:

The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to conduct@creativecommons.org per our reporting guidelines.

Contributing

See CONTRIBUTING.md.

Goals

The aim of the project is to establish a robust and localized development environment utilizing Ansible and Docker. This environment will mirror a professional work setting, incorporating a dedicated security server (Bastion), automation through Ansible, a web server, and a data storage server. This configuration will simplify and secure development processes and serve as a blueprint for future projects at CC.

Docker containers:

The docker-compose.yml file defines the following containers:

  • bastion-dev - Bastion (SSH jump server)
  • ansible-dev - Ansible
  • web-dev - Web server (Apache2/WordPress)
  • db-dev - Database server (MariaDB)

image

See Create Local Ansible Dev Environment Using Docker for more details.

Setup

  • Create the .env file:

    cp .env.example .env
  • Execute the generate_ssh_keys script:

    ./generate_ssh_keys.sh
  • Build and start Docker:

    docker-compose up
  • Wait for the build and initialization to complete

SSH (Work in Progress)

The SSH setup has been established and is currently in use for the Ansible container. Follow the steps below to generate and use the SSH keys for the sysadmin user:

  • Execute the generate-ssh-keys.sh script to generate the keys used by the sysadmin user:

    ./generate-ssh-keys.sh
  • Bring down the existing Docker containers and start them again:

    docker-compose down
    docker-compose up -d
  • Ensure the Docker containers are running:

    docker ps
  • Execute the following command to confirm that SSH is working fine:

    ssh -i ./sysadmin-ssh-keys/rsa_sysadmin -p 22001 sysadmin@localhost

SSH connection information: example local/laptop ~/.ssh/config configugration

Host bastion-dev
    HostName localhost
    User sysadmin
    Port 22222
    IdentityFile /home/sysadmin/.ssh/id_rsa

Host ansible-dev
    HostName ansible-dev
    User sysadmin
    Port 22
    IdentityFile /home/sysadmin/.ssh/id_rsa

Host web-dev
    HostName web-dev
    User sysadmin
    Port 22
    IdentityFile /home/sysadmin/.ssh/id_rsa
  • Assume remote username sysadmin. Replace these values in your own local/laptop configuration.
  • ProxyJump allow you to use ssh bastion to connect to the bastion-dev host, and ssh ansible-dev or ssh web-dev, and SSH will automatically connect through the bastion jump host.

Related Links

License

About

Creative Commons Ansible

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors 4

  •  
  •  
  •  
  •