Skip to content

Commit c38e345

Browse files
committed
Merging master.
2 parents 74279f2 + 8530460 commit c38e345

15 files changed

+170
-464
lines changed

.ansible-lint

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
skip_list:
2+
- '204'
3+
- '301'
4+
- '701'
5+
- '306'

.editorconfig

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 2 space indentation
2+
[*.yml]
3+
indent_style = space
4+
indent_size = 2
5+
trim_trailing_whitespace = true

.gitlab-ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
stages:
3+
- test
4+
- apply
5+
6+
lint:
7+
stage: test
8+
script:
9+
- /home/controller/ce-python/bin/yamllint "$CI_PROJECT_DIR"
10+
11+
apply:
12+
stage: apply
13+
script:
14+
- rsync -avz --delete "$CI_PROJECT_DIR/" SHORTNAME-deploy1.codeenigma.net:/tmp/config
15+
- ssh -t SHORTNAME-deploy1.codeenigma.net "sudo rsync -avz --delete --chown=deploy:deploy /tmp/config/ /home/deploy/ce-deploy/config"
16+
- ssh -t SHORTNAME-deploy1.codeenigma.net "sudo rm -rf /tmp/config"
17+
rules:
18+
- if: '$CI_COMMIT_BRANCH == "1.x"'

.sops.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SOPS will not always be needed, this is a placeholder.
2+
# You will need SOPS only if your deploy jobs have secrets to protect.
3+
creation_rules:
4+
- key_groups:
5+
- pgp: []
6+
#- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # deploy server GPG key - TBD

.yamllint

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# Based on ansible-lint config
3+
extends: default
4+
5+
# Ignore SOPS encrypted files
6+
ignore: |
7+
_encrypted.sops.yml
8+
9+
rules:
10+
braces: {max-spaces-inside: 1, level: error}
11+
brackets: {max-spaces-inside: 1, level: error}
12+
colons: {max-spaces-after: -1, level: error}
13+
commas: {max-spaces-after: -1, level: error}
14+
comments: disable
15+
comments-indentation: disable
16+
document-start: disable
17+
empty-lines: {max: 3, level: error}
18+
hyphens: {level: error}
19+
indentation: disable
20+
key-duplicates: enable
21+
line-length: disable
22+
new-line-at-end-of-file: disable
23+
new-lines: {type: unix}
24+
trailing-spaces: enable

README.md

+63-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,68 @@
11
# Holds private information for the ce-deploy setup
2+
This is a template repository intended as a starting point for new ce-deploy installations. It contains sane defaults and example configurations for more complex infrastructures and all the configuration required for Ansible to work out of the box.
23

3-
## hosts
4-
This will be symlinked to /etc/ansible/hosts
4+
[Find out more about ce-deploy here.](https://github.com/codeenigma/ce-deploy/wiki)
55

6-
## fact.d
7-
This will be symlinked to /etc/ansible/fact.d
6+
# Using AWS EC2 inventory discovery
7+
If you intend to use AWS as one of your hosting providers and you want to enable AWS inventory support, first in `ansible.cfg`. The default config file looks like this:
88

9-
## group_vars
10-
This will be symlinked to /etc/ansible/group_vars
9+
```conf
10+
[inventory]
11+
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto'
12+
enable_plugins = yaml, ini
13+
# uncomment the below line and comment the above for AWS EC2 inventory discovery
14+
#enable_plugins = amazon.aws.aws_ec2, yaml, ini
15+
```
1116

17+
Change it to look like this:
18+
19+
```conf
20+
[inventory]
21+
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto'
22+
enable_plugins = amazon.aws.aws_ec2, yaml, ini
23+
```
24+
25+
Then edit `hosts/aws_ec2.yml` and set it up how you wish.
26+
27+
# Using SOPS for variable encryption
28+
SOPS is loaded in by default, however to use it you will need to add the PGP key fingerprint of any team member who needs to be able to encrypt and decrypt SOPS variables to `.sops.yml` in this repository.
29+
30+
[The SOPS documentation is here.](https://github.com/getsops/sops/blob/main/README.rst)
31+
32+
# Files and directories
33+
Although ce-deploy is fairly flexible, this is a list of supplied files and directories and what they are generally used for. It provides a model for potentially organising your Ansible configuration. If you install ce-deploy with ce-provision these files and directories will be handled as follows:
34+
35+
## Directories
36+
These are the provided directories which are not linked into ce-deploy.
37+
38+
### plays
39+
This is a space where you can optionally keep playbooks that are unique to your organisation.
40+
41+
### roles
42+
This is where we recommend you keep any roles that are unique to your organisation, for example they might contain configurations you do not wish to share or they might be simply of no use to the wider product. For example, we keep roles for managing our LDAP directory server in this directory. It is automatically included in Ansible's roles path in the provided `ansible.cfg`.
43+
44+
## Linked files
45+
These files are obligatory in the config repository and are linked into ce-deploy in the required places to make Ansible function as expected.
46+
47+
### hosts
48+
This will be symlinked to the `hosts` directory in the root of your Ansible installation.
49+
50+
### ansible.cfg
51+
This will be symlinked into the root of your Ansible installation.
52+
53+
More information:
54+
* https://codeenigma.github.io/ce-provision-docs/2.x/roles/debian/ce_deploy/
55+
* https://github.com/codeenigma/ce-provision/blob/2.x/roles/debian/ce_deploy/tasks/main.yml#L56-L91
56+
57+
# Beware the `deploy` user
58+
We assume your `ce-deploy` user `deploy` - if that is not the case you will need to replace `deploy` with the replacement value for usernames in `ansible.cfg`.
59+
60+
# Seeding `ce-deploy` config
61+
This repo is a template for seeding a new configuration repo for `ce-deploy` which will get pulled on to the deploy server when the `ce_deploy` role is used in `ce-provision`. Copy this over the repo you created above then find and replace these strings before committing:
62+
63+
* `SHORTNAME` - should be your client shortname, e.g. `acme`
64+
65+
Tip - this terminal command will make your life easier: `find ./ -type f -exec sed -i -e 's/SHORTNAME/acme/g' {} \;`
66+
67+
# SOPS
68+
There is an example `.sops.yaml` file included in case you need SOPS. Many projects will not, but if you need to include encrypted secrets, such as API keys or credentials to other third party systems that web applications need to have in order to be deployed, you will need to configure this. It can certainly be ignored for a first pass set-up.

0 commit comments

Comments
 (0)