Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

resetenv

This role permits to install/configure a basic development environment.

Features

  • Installs and configures :

    • some basic packages

    • some basic config files

    • docker, docker-compose, docker-machine

    • packer, vagrant, terraform

    • ssh config files

Prerequisites

  • Fedora 26

  • Ansible 2.3

Install & Configure it

Get the code source :

$ git clone <REPO_URL> /local/path

Sensitive data and variables are located in "vaulted" files inside the vars directory.

If you want to reuse this role, you must create your vaulted files with your own data and "vault" them with your own password.

You have to create three vaulted files inside a vars directory (not "versioned" files) :

  • common-vars.yml.vault : containing common variables

  • sshconfig.yml.vault : containing SSH config variables

  • work-vars.yml.vault : containing work specific variables

Configure common variables

$ ansible-vault create vars/common-vars.yml.vault

Example of common-vars.yml.vault file content :

 ---
 user:
 name: mikl
 fullName: Michael Pailloncy
 email: michael.pailloncy@gmail.com
 home: /home/mikl
 cachedir: /home/mikl/.ansible-cache
 tools:
 path: /home/mikl/tools
 proxy:
 host: my-work-proxy.hostname
Warning
You need to replace all $variables by your specific values

By default, resetenv script will search a file named .vault-password containing your password and use it to "unvault" your data. You need to create it inside resetenv directory :

$ echo "yourP@ssw0rd" > .vault-password

Configure SSH config variables

$ ansible-vault create vars/sshconfig.yml.vault

Example of sshconfig.yml.vault file content :

---
sshconfig:
 hosts:
 host1: >
 Host host1
 HostName hostname1
 User userhost1
 host2: >
 Host host2
 HostName hostname2
 User userhost2
 ...

Configure Work specific variables

$ ansible-vault create vars/work-vars.yml.vault

Example of work-vars.yml.vault file content :

---
user:
 name: mikl
 fullName: Michael Pailloncy
 email: work-email@company.fr
 home: /home/mikl
docker_internal_registry: "my-internal-docker-registry.hostname"
proxy:
 host: $workProxyHost
 port: $workProxyPort
 user: $workProxyUsername
 password: $workProxyPassword
proxy_env:
 http_proxy: 'http://{{ proxy.user }}:{{ proxy.password }}@{{ proxy.host }}:{{ proxy.port }}'
 https_proxy: 'http://{{ proxy.user }}:{{ proxy.password }}@{{ proxy.host }}:{{ proxy.port }}'
 no_proxy: '127.0.0.1,$internalDockerRegistryHostname'
Warning
You need to replace all $variables by your specific values

Run it !

Warning
Make sure that you have read all actions made by this playbook and saved all files susceptible to be erased (zshrc, ssh config files, docker config files, etc) before run it on a non "config-managed" environment.
$ ./resetenv
Tip
resetenv shell script is added in your PATH after provisioning (see zshrc template file). With a fresh new terminal, you can run it anywhere.
Tip
You can add any ansible-playbook options to resetenv shell script. Example: resetenv -t fast for a fast and basic reconfiguration (using fast tag).

Everyday usage

After a first full provisioning has been done, the only way I’m using resetenv is to reset basic configuration files (docker, dnf, http_proxy settings) depending on my current location (work vs home).

Examples :

$ r -t fast

or more often :

$ twork

This command is an alias to do a resetenv -t fast and start tmunixator directly configured depending on my location (see templates/zshrc and templates/tmuxinator/work.yml).

About

Auto provisioning of my dev machine using Ansible on Fedora 26

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /