Skip to content
Snippets Groups Projects
Commit 49264578 authored by nimrod's avatar nimrod
Browse files

AWS config and Makefile cleanup.

- Implicit rule for SSH keys, instead of copying and pasting over and
  over and over again.
- Re-add the curl and download variables that were removed in
  e44ff1f2.
- Variable for creating the directory in the Makefile.
- Add the AWS config, generate the credentials file.
parent 73c71d72
No related branches found
No related tags found
No related merge requests found
[profile shore]
region = us-east-1
DESTDIR ?= .local
ansible-local = ansible localhost -c local -i localhost, -e "ansible_python_interpreter=$$(which python3)" ansible-local = ansible localhost -c local -i localhost, -e "ansible_python_interpreter=$$(which python3)"
ssh_configs != find ".ssh/config.d/" -type f \! -name '.*' | sort ssh_configs != find ".ssh/config.d/" -type f \! -name '.*' | sort
curl = curl --location --silent --fail
download = $(curl) --output $@
mkd = mkdir -p $$(dirname $@)
.PHONY: all
all: .ssh/gitlab_ed25519
all: .ssh/gitlab_fdo
all: .ssh/gitlab_toptal
all: .ssh/github_ed25519
all: .ssh/shore_ecdsa
all: .ssh/shore_ed25519
all: .ssh/shore_rsa
all: .ssh/smile_ed25519
all: .ssh/smile_rsa
.ssh/%: Documents/Database.kdbx
$(mkd)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
# Disable the implicit rule above so that other files under .ssh/ will be
# created using an explicit rule.
.ssh/%: Documents/Database.kdbx
all: .config/pythonrc.py all: .config/pythonrc.py
.config/pythonrc.py: .config/pythonrc.py:
mkdir -p $$(dirname $@) $(mkd)
$(download) https://raw.githubusercontent.com/lonetwin/pythonrc/0.8.4/pythonrc.py $(download) https://raw.githubusercontent.com/lonetwin/pythonrc/0.8.4/pythonrc.py
all: .bashrc.private all: .bashrc.private
...@@ -14,84 +36,30 @@ all: .bashrc.private ...@@ -14,84 +36,30 @@ all: .bashrc.private
echo "export GITLAB_REGISTRATION_TOKEN='$$(ph show --field Password 'shore.co.il/GitLab runner registration token')'" >> '$@' echo "export GITLAB_REGISTRATION_TOKEN='$$(ph show --field Password 'shore.co.il/GitLab runner registration token')'" >> '$@'
echo "export GITHUB_TOKEN='$$(ph show --field 'CLI token' 'Web Sites/GitHub')'" >> '$@' echo "export GITHUB_TOKEN='$$(ph show --field 'CLI token' 'Web Sites/GitHub')'" >> '$@'
all: .ssh/github_ed25519
.ssh/github_ed25519: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/gitlab_fdo
.ssh/gitlab_fdo: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/gitlab_toptal
.ssh/gitlab_toptal: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/shore_rsa
.ssh/shore_rsa: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/gitlab_ed25519
.ssh/gitlab_ed25519: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/shore_ecdsa
.ssh/shore_ecdsa: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/shore_ed25519
.ssh/shore_ed25519: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/smile_rsa
.ssh/smile_rsa: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/smile_ed25519
.ssh/smile_ed25519: Documents/Database.kdbx
mkdir -p $$(dirname $@)
ph show --field Notes "SSH/$$(basename '$@')" > '$@'
chmod 600 '$@'
all: .ssh/config all: .ssh/config
.ssh/config: $(ssh_configs) .ssh/config: $(ssh_configs)
mkdir -p $$(dirname $@) $(mkd)
cat $(ssh_configs) > $@ cat $(ssh_configs) > $@
all: .ssh/localhost all: .ssh/localhost
.ssh/localhost: .ssh/localhost:
mkdir -p $$(dirname $@) $(mkd)
-rm $@ $@.pub -rm $@ $@.pub
ssh-keygen -t ecdsa -N '' -C localhost -f $@ ssh-keygen -t ecdsa -N '' -C localhost -f $@
all: .ssh/localhost.pub all: .ssh/localhost.pub
.ssh/localhost.pub: .ssh/localhost .ssh/localhost.pub: .ssh/localhost
mkdir -p $$(dirname $@) $(mkd)
ssh-keygen -y -f $< > $@ ssh-keygen -y -f $< > $@
all: .ssh/authorized_keys all: .ssh/authorized_keys
.ssh/authorized_keys: .ssh/localhost.pub .ssh/authorized_keys: .ssh/localhost.pub
mkdir -p $$(dirname $@) $(mkd)
-$(ansible-local) -m authorized_key -a "user=$$(whoami) key='$$(cat .ssh/localhost.pub)' key_options='from=\"127.0.0.1/8\"'" -$(ansible-local) -m authorized_key -a "user=$$(whoami) key='$$(cat .ssh/localhost.pub)' key_options='from=\"127.0.0.1/8\"'"
all: .config/python-gitlab.cfg all: .config/python-gitlab.cfg
.config/python-gitlab.cfg: Documents/Database.kdbx .config/python-gitlab.cfg: Documents/Database.kdbx
mkdir -p $$(dirname $@) $(mkd)
echo '[global]' > '$@' echo '[global]' > '$@'
echo 'default = shore.co.il' >> '$@' echo 'default = shore.co.il' >> '$@'
echo 'ssl_verify = true' >> '$@' echo 'ssl_verify = true' >> '$@'
...@@ -103,7 +71,7 @@ all: .config/python-gitlab.cfg ...@@ -103,7 +71,7 @@ all: .config/python-gitlab.cfg
all: .config/gem/gemrc all: .config/gem/gemrc
.config/gem/gemrc: Documents/Database.kdbx .config/gem/gemrc: Documents/Database.kdbx
mkdir -p $$(dirname $@) $(mkd)
echo '# vim: ft=yaml' > '$@' echo '# vim: ft=yaml' > '$@'
echo '---' >> '$@' echo '---' >> '$@'
echo ':backtrace: false' >> '$@' echo ':backtrace: false' >> '$@'
...@@ -114,3 +82,10 @@ all: .config/gem/gemrc ...@@ -114,3 +82,10 @@ all: .config/gem/gemrc
echo ':update_sources: true' >> '$@' echo ':update_sources: true' >> '$@'
echo ':verbose: true' >> '$@' echo ':verbose: true' >> '$@'
echo ':concurrent_downloads: 8' >> '$@' echo ':concurrent_downloads: 8' >> '$@'
all: .aws/credentials
.aws/credentials: Documents/Database.kdbx
$(mkd)
echo '[shore]' > '$@'
echo "aws_access_key_id = $$(ph show --field 'UserName' 'shore.co.il/AWS CLI')" >> '$@'
echo "aws_secret_access_key = $$(ph show --field 'Password' 'shore.co.il/AWS CLI')" >> '$@'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment