Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to pipenv #31

Merged
merged 8 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ skip_list:
- command-instead-of-shell # Use shell only when shell functionality is required
- experimental # all rules tagged as experimental
- no-changed-when # Commands should not change things if nothing needs doing

- name[casing]
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip pipenv
Expand Down
7 changes: 4 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ verify_ssl = true
ansible = "*"
ansible-lint = "*"
flake8 = "*"
molecule-docker = "*"
yamllint = "==1.20.0"
yamllint = "*"
molecule = "*"
molecule-plugins = {extras = ["docker"], version = "*"}

[requires]
python_version = "3.9"
python_version = "3.10"
1,208 changes: 667 additions & 541 deletions Pipfile.lock

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,68 @@ ANSIBLE_REPO="https://github.com/yuhonas/dotfiles.git"
export ANSIBLE_NOCOWS=1

if [ "$(uname)" == "Darwin" ]; then
# Download and install Command Line Tools
if [[ ! -x /usr/bin/gcc ]]; then
echo "Info | Install | xcode"
xcode-select --install
fi
# Download and install Command Line Tools
if [[ ! -x /usr/bin/gcc ]]; then
echo "Info | Install | xcode"
xcode-select --install
fi

# Download and install homebrew
if [[ ! -x /opt/homebrew/bin/brew ]]; then
echo "Info | Install | homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
eval $(/opt/homebrew/bin/brew shellenv)
# Download and install homebrew
if [[ ! -x /opt/homebrew/bin/brew ]]; then
echo "Info | Install | homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
eval $(/opt/homebrew/bin/brew shellenv)
else
# Download and install linuxbrew
if [[ ! -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
# archlinux
sudo pacman --sync --refresh --noconfirm --needed \
base-devel \
git ca-certificates \
curl \
git \
libxcrypt-compat # for homebrew installation which installs ruby 2.6.8
# Download and install linuxbrew
if [[ ! -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
# archlinux
sudo pacman --sync --refresh --noconfirm --needed \
base-devel \
git ca-certificates \
curl \
git \
libxcrypt-compat # for homebrew installation which installs ruby 2.6.8

# set locale
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
# set locale
sudo localedef -i en_US -f UTF-8 en_US.UTF-8

echo "Info | Install | linuxbrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>$HOME/.bash_profile
fi
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
echo "Info | Install | linuxbrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>$HOME/.bash_profile
fi
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
fi

brew update

# Download and install git
if ! type git > /dev/null 2>&1; then
echo "Info | Install | git"
brew install git
if ! type git >/dev/null 2>&1; then
echo "Info | Install | git"
brew install git
fi

# Download and install Ansible
if ! type ansible > /dev/null 2>&1; then
echo "Info | Install | ansible"
brew install ansible
if ! type ansible >/dev/null 2>&1; then
echo "Info | Install | ansible"
brew install ansible
fi

# Make the code directory
mkdir -p $SRC_DIRECTORY

# Clone down ansible
if [[ ! -d $ANSIBLE_DIRECTORY ]]; then
git clone $ANSIBLE_REPO $ANSIBLE_DIRECTORY
git clone $ANSIBLE_REPO $ANSIBLE_DIRECTORY

# if we're part of a build we should checkout the supplied SHA
if [[ -n "$GITHUB_SHA" ]]; then
git checkout "$GITHUB_SHA"
fi
# if we're part of a build we should checkout the supplied SHA
if [[ -n "$GITHUB_SHA" ]]; then
git checkout "$GITHUB_SHA"
fi
fi

if [[ -z "$NO_PROVISION" ]]; then
# Provision the box
ansible-playbook --ask-become-pass --become-method=sudo -i $ANSIBLE_DIRECTORY/inventory $ANSIBLE_DIRECTORY/playbook.yml
# Provision the box
ansible-playbook --ask-become-pass --become-method=sudo -i $ANSIBLE_DIRECTORY/inventory $ANSIBLE_DIRECTORY/playbook.yml
fi

3 changes: 3 additions & 0 deletions molecule/default/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RUN set -xe \
&& sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers \
&& sed -i "/%wheel/s/^# //g" /etc/sudoers

# set ansible user password to ansible
RUN echo "${ANSIBLE_USER}:${ANSIBLE_USER}" | chpasswd

USER ${ANSIBLE_USER}:${ANSIBLE_USER}
WORKDIR /home/${ANSIBLE_USER}

Expand Down
29 changes: 29 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: Fail if molecule group is missing
hosts: localhost
tasks:
- name: Print some info
ansible.builtin.debug:
msg: "{{ groups }}"

- name: Assert group existence
ansible.builtin.assert:
that: "'molecule' in groups"
fail_msg: |
molecule group was not found inside inventory groups: {{ groups }}

- name: Converge
hosts: molecule
# We disable gather facts because it would fail due to our container not
# having python installed. This will not prevent use from running 'raw'
# commands. Most molecule users are expected to use containers that already
# have python installed in order to avoid notable delays installing it.
gather_facts: false
tasks:
- name: Check uname
ansible.builtin.raw: uname -a
register: result
changed_when: false

- name: Print some info
ansible.builtin.assert:
that: result.stdout | regex_search("^Linux")
22 changes: 15 additions & 7 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
---
driver:
name: "docker"
lint: |
set -e
# yamllint .
ansible-lint -x formatting playbook.yml roles/
flake8
name: docker
dependency:
name: galaxy
options:
requirements-file: requirements.yml
# lint: |
# set -e
# # yamllint .
# ansible-lint -x formatting playbook.yml roles/
# flake8
platforms:
- name: "molecule_instance"
- name: molecule_instance
image: "archlinux/archlinux:latest"
platform: amd64
pre_build_image: false
env:
PATH: "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
ANSIBLE_USER: "linuxbrew"
SUDO_GROUP: "wheel"
DEPLOY_GROUP: "deployer"
scenario:
name: default
provisioner:
name: "ansible"
env:
Expand Down
3 changes: 3 additions & 0 deletions molecule/default/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
collections:
- name: community.docker
version: ">=3.10.2"
15 changes: 0 additions & 15 deletions roles/developer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- borgbackup # for secure incremental backups
- coreutils
- ctags # index generation for source and header files
- emacs
- jdupes # faster then fdupes
- fx # for exploring json files in the terminal
- grex # A tool generating regular expressions from user-provided test cases
Expand Down Expand Up @@ -37,20 +36,6 @@
- uv # pip replacement https://github.com/astral-sh/uv
- w3m # text based browser

# - name: find where asdf was installed
# command: "brew --prefix asdf"
# register: asdf_location
# changed_when: false

# - debug: msg="{{ asdf_location.stdout }}"

#- name: ensure asdf is in the $PATH
# blockinfile:
# path: "{{ ansible_env.HOME }}/.bashrc"
# block: |
# export ASDF_DIR={{ asdf_location.stdout }}
# export PATH=~/.asdf/shims:$PATH

- name: add asdf plugins
command: "asdf plugin-add {{ item }}"
with_items:
Expand Down
3 changes: 3 additions & 0 deletions roles/dotfiles/files/Mackup/.bundle/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ BUNDLE_GEM__TEST: "rspec"
BUNDLE_GEM__MIT: "false"
BUNDLE_GEM__COC: "true"
BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/usr/local/opt/openssl"
BUNDLE_GEM__CI: "github"
BUNDLE_GEM__CHANGELOG: "false"
BUNDLE_GEM__LINTER: "rubocop"
Loading