Adding new environments
Adding a whole new environment
Clone the AFD2 repository -- not the Splunk repo. Open hosts/hosts in your favorite editor.
You'll need to add a new environment below qa
.
Example
hosts file with a new environment
[prod]
splunk-util.example.com
splunk-index-master.example.com
[qa]
splunk-qa-util.example.com
[staging]
splunk-stage.example.com
Next, create a file in the group_vars
folder named as your environment. Its contents should look like this:
Example
new group_vars file:
shcluster_bundle_target: https://splunk-search01.example.com:8089
deployment_server: splunk-util.example.com:8089
splunk_environment: prod
splunk_environment_name: splunk
You can then push to your new environment with ansible-playbook main.yml --limit your-env-name
Updating submodule reference
- Clone the splunk config repo and run
git submodule update --recursive --init
to initialize the AFD2 submodule - Create a new branch matching your environment name with
git checkout -b your-env-name
cd
intoafd2
foldergit checkout master
(or whatever branch your stuff is on in AFD2).- Commit and push as appropriate.
Updating CI to push to your environment
- Open
.gitlab-ci.yml
from the Splunk repo. - Copy one of the existing blocks and paste it at the bottom
- Update the name to be meaningful
- Update the
--limit
to point to your new environment name - Update
only
to include your branch name. (this is probably what you want). - Commit and push as appropriate.
Adding environment
- In the
.gitlab-ci.yml
file, change the environment name to something meaningful. - Change the
url
to point to your env's web interface.
Adding secrets to deploy
Secrets are defined per-environment. You'll need to go into the vault file and either add new secrets or add your environment to existing secrets, as appropriate.
Adding hosts to an existing environment
Clone the AFD2 repository -- not the Splunk repo. Open hosts/hosts in your favorite editor.
Each host will need to be added in at least two places: first, the environment (either prod
or qa
), and second, the role. It should be sufficient to simply put the FQDN of the host.
On-host setup
You will need to configure the ssh public key on the node. On a default Splunk install, it goes in ~splunk/.ssh/authorized_keys